python and c++

Started by
2 comments, last by athos_musketeer 20 years, 10 months ago
Hi guys. is there a good tutorial about how to pass c++ object into a python script? thanks to all.
Advertisement
You need to expose your C++ class as part of a Python extension module.

See either here or here (also in your doc)

This will allow the interpreter to use the C++ class as if it was a Python class.

If, on the other hand, you are in a C++ program embedding a python interpreter, and you want to pass an existing object to the interpreter, you need to build a PyObject* reference to the object and use the API to associate a reference in the interpreter with that PyObject (or see Boost''s API)
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Here's a good tutorial that I found that really helped me out.

http://tutorials.impereonsoft.com/python/extemb.html

edit - url
-----------------------------
kevin@mayday-anime.com
http://www.mayday-anime.com

[edited by - grasshopa55 on June 17, 2003 10:26:09 AM]
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com
Thank you all!!!!

really thanks!!

This topic is closed to new replies.

Advertisement