[pypy-dev] Biting off more than I can chew
Amaury Forgeot d'Arc
amauryfa at gmail.com
Tue Feb 21 01:24:04 CET 2012
2012/2/21 Greg Bowyer <gbowyer at fastmail.co.uk>
> My question (probably one of many to irritate and annoy all the fine folks
> here) would be, is there a sensible way to compile into pypy a small amount
> of C code that can be used to bootstrap and bridge some esoteric c
> libraries into pypy, the code that I want to run, on startup of pypy would
> be the following https://bitbucket.org/**GregBowyer/pypy-c4gc/**
> changeset/0de575b3a8d1#chg-**azm_mem_test/test.c<https://bitbucket.org/GregBowyer/pypy-c4gc/changeset/0de575b3a8d1#chg-azm_mem_test/test.c>
>
It's not annoying at all, we use it in strategic places.
For example, see how pypy/rlib/_rffi_stacklet.py implements a
stacklet C library that can be used in RPython.
It uses an "ExternalCompilationInfo" (eci) object:
- separate_module_files lists the .c files you want to compile and link
- separate_module_sources is an easy way to embed C snippets (each source
will create a .c file)
Then you can use rffi.llexternal with "compilation_info=eci"
to declare a function defined in this library.
--
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120221/6f6be098/attachment.html>
More information about the pypy-dev
mailing list