diff options
-rw-r--r-- | demo/gmp.py | 12 | ||||
-rw-r--r-- | demo/gmp_build.py | 2 |
2 files changed, 5 insertions, 9 deletions
diff --git a/demo/gmp.py b/demo/gmp.py index af96be3..44f233c 100644 --- a/demo/gmp.py +++ b/demo/gmp.py @@ -5,18 +5,14 @@ import sys # http://bazaar.launchpad.net/~tolot-solar-empire/+junk/gmpy_cffi/files # -# If the build script was run immediately before this script, the cffi module -# ends up in the current directory. Make sure we can import it. -sys.path.append('.') - try: - from _gmp import ffi, lib + from _gmp_cffi import ffi, lib except ImportError: print 'run gmp_build first, then make sure the shared object is on sys.path' - sys.exit(-1) + sys.exit(1) # ffi "knows" about the declared variables and functions from the -# cdef parts of the module xclient_build created, +# cdef parts of the module created from gmp_build # lib "knows" how to call the functions from the set_source parts # of the module. @@ -27,7 +23,7 @@ b = ffi.new("mpz_t") if len(sys.argv) < 3: print 'call as %s bigint1, bigint2' % sys.argv[0] - sys.exit(-1) + sys.exit(2) lib.mpz_init_set_str(a, sys.argv[1], 10) # Assume decimal integers lib.mpz_init_set_str(b, sys.argv[2], 10) # Assume decimal integers diff --git a/demo/gmp_build.py b/demo/gmp_build.py index 87266a4..7afe471 100644 --- a/demo/gmp_build.py +++ b/demo/gmp_build.py @@ -19,7 +19,7 @@ ffi.cdef(""" """) -ffi.set_source('_gmp', "#include <gmp.h>", +ffi.set_source('_gmp_cffi', "#include <gmp.h>", libraries=['gmp', 'm']) if __name__ == '__main__': |