Hi.<div><br><div class="gmail_quote">On Tue, Mar 20, 2012 at 3:36 PM, Roberto De Ioris <span dir="ltr"><<a href="mailto:roberto@unbit.it">roberto@unbit.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
> Hi all.<br>
><br>
> I want to embed pypy into c code, but in pypy's directory, i don't find<br>
any pypy's c api, except in cypext directory.<br>
><br>
> And I want to use stackless' c api too,. but i still have not found any<br>
stackless api(example stackless_api.h) in pypy.<br>
><br>
> Thanks.<br>
><br>
> --<br>
><br>
<br>
Currently you are on your own.<br>
<br>
This is the step i follow:<br>
<br>
1) patch genc.py to export RPython_StartupCode in addition to<br>
pypy_main_startup<br>
<br>
export_symbols=["pypy_main_startup", "RPython_StartupCode"]))<br>
<br>
and run:<br>
<br>
pypy translate.py -Ojit --shared<br>
<br>
to build libpypy<br>
<br>
2) add this declaration on top of your code<br>
<br>
#ifdef UWSGI_PYPY<br>
char *RPython_StartupCode(void);<br>
#define pypy_asm_stack_bottom() asm volatile ("/* GC_STACK_BOTTOM */" : :<br>
: \<br>
"memory")<br>
<br>
#endif<br>
<br>
3) instead of Py_Initialize() call<br>
<br>
pypy_asm_stack_bottom();<br>
RPython_StartupCode();<br>
<br>
After that you have an almost working pypy environment.<br>
<br>
A bunch of python c api functions are not implemented (but you will find<br>
it is pretty easy to add them, even as noop) so be prepared to some<br>
compromise.<br>
<br>
What kills me is the amount of time taken to rebuild the whole library, so<br>
i can work on it only on spare time (i am porting both mod_wsgi and uWSGI)<br>
:)<br>
<br>
<br>
--<br>
Roberto De Ioris<br>
<a href="http://unbit.it" target="_blank">http://unbit.it</a><br>
</div></div>_______________________________________________<br>
pypy-dev mailing list<br>
<a href="mailto:pypy-dev@python.org">pypy-dev@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">http://mail.python.org/mailman/listinfo/pypy-dev</a><br>
</blockquote></div><br><div><br></div><div>I have <span style="font-size:13px;font-family:'Microsoft YaHei';white-space:nowrap">several problem(because compile pypy is slow ):</span><div><font face="'Microsoft YaHei'"><span style="white-space:nowrap"><br>
</span></font></div><div><font face="'Microsoft YaHei'"><span style="white-space:nowrap">1 add "</span></font>export_symbols=["pypy_main_startup", "RPython_StartupCode"]))" to genc.py in which line? or top line?</div>
<div><br></div><div>2 this will export stackless c api?</div></div><div><div><br></div><div>Thanks.</div>-- <br><div><span style="color:rgb(102,102,102);font-family:Arial,Helvetica,sans-serif;font-size:12px;line-height:18px;background-color:rgb(255,246,237)">do not fear to be eccentric in opinion, for every opinion now accepted was once eccentric. </span></div>
<br>
</div></div>