🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
python and c++
Hi guys.
is there a good tutorial about how to pass c++ object into a python script?
thanks to all.
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)
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)
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement