<div class="gmail_quote">2012/2/21 Greg Bowyer <span dir="ltr"><<a href="mailto:gbowyer@fastmail.co.uk">gbowyer@fastmail.co.uk</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div id=":2zf">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 <a href="https://bitbucket.org/GregBowyer/pypy-c4gc/changeset/0de575b3a8d1#chg-azm_mem_test/test.c" target="_blank">https://bitbucket.org/<u></u>GregBowyer/pypy-c4gc/<u></u>changeset/0de575b3a8d1#chg-<u></u>azm_mem_test/test.c</a></div>
</blockquote><div><br></div><div>It's not annoying at all, we use it in strategic places.</div><div>For example, see how pypy/rlib/_rffi_stacklet.py implements a</div><div>stacklet C library that can be used in RPython.</div>
<div><br></div><div>It uses an "ExternalCompilationInfo" (eci) object:</div><div>- separate_module_files lists the .c files you want to compile and link</div><div>- separate_module_sources is an easy way to embed C snippets (each source will create a .c file)</div>
<div><br></div><div>Then you can use rffi.llexternal with "compilation_info=eci"</div><div>to declare a function defined in this library.</div><div><br></div></div>-- <br>Amaury Forgeot d'Arc<br>