accessing a char* from a dl.sym

Johannes Zellner johannes at zellner.org
Fri Jul 7 17:17:52 EDT 2000


Hello,

this question is really a question about a /dirty/ hack.
Anyway: suppose I've

    import dl
    handle = dl.open('/usr/lib/libreadline.so')
    cp = handle.sym('rl_completion_append_character')
    print cp

so far so good. cp contains a pointer to a c (char*) pointer.
Can I assign something to this pointer ?

    1) how do I assign a 0 from python, what would read in c:
       *rl_completion_append_character = 0;
    1) how do I assign a string from python, again in c it would be:
       rl_completion_append_character = strdup('fred');

any help would be much appreciated.

-- 
   Johannes





More information about the Python-list mailing list