[pypy-dev] Compiling RPython with ctypes

Amaury Forgeot d'Arc amauryfa at gmail.com
Tue Jul 12 18:34:49 CEST 2011


2011/7/12 Andrew Evans <andrew.rustytub at gmail.com>

> Hello I am running into some snags developing an executable in pypy with
> translate.py and wondering what the best method for me to do this with my
> code would be. I am developing an Exploit Framework and one of the features
> I would like to have is compiling an executable. I am wondering if this is
> even possible with my code but it does run in the PyPy Interpreter
>

ctypes is not RPython at all.
But you can use the "lltype" and "rffi" modules.
Your code will certainly use things like:

FUNCTYPE = lltype.Ptr(lltype.FuncType([], rffi.INT))
ptr = rffi.str2charp(machineCode)  # returns a "char*" pointer
my_callback = rffi.cast(FUNCTYPE, ptr)

my_callback() # beware!

-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110712/ae2c497e/attachment-0001.html>


More information about the pypy-dev mailing list