Hello All,

Playing around with ctypes, I'm try to use gmp (gmpy is excellent but
I want to learn ctypes).

I'm running:

#!/usr/bin/env python

from ctypes import *

class mpz(Structure):
    _fields_ = [
        ("_mp_alloc", c_int),
        ("_mp_size", c_int),
        ("_mp_d", POINTER(c_uint)),
    ]

gmp = cdll.LoadLibrary("libgmp.so")
m = mpz()
gmp.__gmpz_init(byref(m))
gmp.__gmpz_set_ui(byref(m), 27)
gmp.__gmp_printf("m is %d\n", byref(m))

However, the output is:
m is -1210863888

Any ideas?
(gmp.h can bee view at http://tinyurl.com/yrqen4)

Thanks,
--
Miki <[EMAIL PROTECTED]>
http://pythonwise.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to