I believe I'm having the same problem. Did you figure out how to fix
The following small example shows the problem:
cdef extern from *:
ctypedef struct wchar_t
ctypedef wchar_t* LPCWSTR "const wchar_t*"
cdef public int xPy_foo(LPCWSTR szScriptName):
main(int argc, char** argv)
$ cython --cplus x.pyx
$ g++ -I/usr/include/python2.7 -std=c++11 xx.cpp x.cpp -lpython2.7
/tmp/cc7xBcE5.o: In function `main':
xx.cpp:(.text+0x15): undefined reference to `xPy_foo'
collect2: error: ld returned 1 exit status
If I add extern "C" to the the xPy_foo definition in x.cpp, it will
I'm using cython built from a git clone that I just made.
(I know the code is bogus, but it does demonstrate the problem.)
On May 15, 12:02 am, Bastien Léonard <bastien.leon...@gmail.com
> I have a C++ Cython project which has a few public
> functions. These functions are called from a C++ file that
> contains code that I couldn't write in Cython. The project
> doesn't run anymore, because most of these functions can't be
> found at runtime. The reason is that the .h file generated by
> Cython contains __PYX_EXTERN_C declarations, but most the
> functions aren't declare with that macro in the generated C++
> file (for some reason, one public function does get declared withexternC). So the shared object exports the mangled function