How to call a python function in C++
Andrew Markebo
flognat at flognat.myip.org
Mon Oct 8 03:07:46 EDT 2001
Just a couple of thoughts..
Are you trying the code you sent here, or it is an excerpt? I
mean.. ;-) sometimes you static-declare a function in a class in c++
to be able to call it from the outside without an instance..
Tried to do extern "C" around the function?? Maybe python is looking
for c-names, not c++-names??
/Andy
/ clio <wangye1 at auburn.edu> wrote:
| Thank you for your help.
|
| I did not add the my_set_callback in method table. But now I can not
| access my_callback in python. The error like this:
|
| >>> import provapi
| Diffusion Routing Agent: Initializing... Agent ID = 32792
| >>> def happy(binstr): print binstr
| ...
| >>> provapi.set_callback(happy)
| >>> print provapi.my_callback
| Traceback (innermost last):
| File "<stdin>", line 1, in ?
| AttributeError: my_callback
| >>> print happy
| <function happy at 80d99e8>
| >>>
|
| It seems that set_callback doesn't work. But I don't know why?
|
| Thank you again.
|
| clio
|
--
The eye of the beholder rests on the beauty!
More information about the Python-list
mailing list