Trying to send parameters from a simple Python function to C++ -
i'm trying link python script c++ script. found , works. foo.cpp #include <iostream> class foo{ public: void bar(){ std::cout << "test!" << std::endl; } }; extern "c" { foo* foo_new(){ return new foo(); } void foo_bar(foo* foo){ foo->bar(); } } foowrapper.py from ctypes import cdll lib = cdll.loadlibrary('./libfoo.so') class foo(object): def __init__(self): self.obj = lib.foo_new() def bar(self): lib.foo_bar(self.obj) f = foo() f.bar() to compile use: g++ -c -fpic foo.cpp -o foo.o g++ -shared -wl,-soname,libfoo.so -o libfoo.so foo.o if -soname doesn't work, use -install_name : g++ -c -fpic foo.cpp -o foo.o g++ -shared -wl,-install_name,libfoo.so -o libfoo.so foo.o and execute just: python foowrapper.py this works, prints me 'test!' of bar() function. the thing want send parameters python function c++ function i've trie...