0

Description: I got two C++ classes named bclass and nclass. Both of two classes have made by .so already. My target is to use python to create a nclass and call a method named add in nclass. By the way, nclass depends on bclass. I plan to use ctypes module, but when a write the code "lib=CDLL("./libnclass.so")"

an error comes and show that

"OSError: libbclass.so: cannot open shared object file:No such file or directory"

When I just call libbclass.so program is OK

So I got two questions,

first,

how do I call nclass in python,

second

how do I create an object by nclass and using some method in nclass

Community
  • 1
  • 1
Bob.li
  • 1
  • Please check this [post](https://raspberrypi.stackexchange.com/questions/30153/oserror-libportmidi-so-cannot-open-shared-object-file-no-such-file-or-directo) to get rid of this error ''OSError: libbclass.so: cannot open shared object file:No such file or directory". – jose praveen Jul 29 '17 at 07:56
  • Just to warn you, your code will not be portable across different c++ compilers. If you know the compiler of the so, then you can still use the library, you'll just have to figure out what name mangling convention it uses. https://stackoverflow.com/questions/1615813/how-to-use-c-classes-with-ctypes – Dunes Jul 29 '17 at 13:45

0 Answers0