[pypy-dev] How to store RPython object in external c?

LvQi lvsoft at gmail.com
Wed May 20 02:43:27 CEST 2009


Hi all,

  I'm learning how to use rffi and lltype system to access external C
library in RPython. And in some case, I need to store RPython object in
external C array. For example:

class RPythonObj:
    def test(): return 1
    .... ....
c_source=py.code.Source("
void*store=NULL;

void c_call_set(???){
   store=???;
}
??? c_call_get(){
    return store;
}")

_c_call_set=llexternal("c_call_set", [???], lltype.Void, ...)
_c_call_get=llexternal("c_call_get", [], ???, ...)

def test():
    o=RPythonObj()
    _c_call_set(o)
    o2=_c_call_get()
    o2.test()

Is that possible? If so, what should I put in ???
Thanks very much~

-- 
Lv Qi
Ph.D Candidate
CS Department
Nanjing University
Nanjing 210093
China
Tel: 86-138-5228-2381
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20090520/295d67e6/attachment.html>


More information about the Pypy-dev mailing list