2012/2/21 Greg Bowyer <gbow...@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
_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to