[IronPython] Cast to a method pointer using CTYPES

Andrew Evans evans.d.andrew at gmail.com
Wed Feb 9 19:40:30 CET 2011


Forgive me if what I ask is a novice question. I have some C code that was
asked to bring to Python I prefer IronPython and remember seeing that CTYPES
was implemented into it :-)

I am not really the best C coder and was suggested by C coders that it
couldn't be done in Python. I aim to prove them wrong

int main(int argc, char **argv)
{
   int (*func)();
   func = (int (*)()) myCode;
   printf("myCode Length is : %d",strlen(myCode));
   (int)(*func)();

}

is it possible to cast to a function pointer in IronPython using CTYPES I
was looking at the CTYPES docs and from what I understand CTYPES has
something called callback functions.

Anyway any idea or help

would be very valuable

Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20110209/307eccc7/attachment.html>


More information about the Ironpython-users mailing list