Craig Macomber | 4 Sep 00:15 2010
Picon

"unresolved external symbol" On Windows trying to call Panda3D's C++ API

I believe I might be seeing this issue, but I'm not sure:
http://trac.cython.org/cython_trac/ticket/106

I'm trying to compile a trivial Cython script that makes a call into
Panda3D's C++ API (Panda has a great python API, but it's easy to mix
with the C++ API, which seems like a nice job for Cython). It works
great for me on my Macs. On Windows, I have to use MSVC compiler (Form
Visual Studio 2008 Express) to work with Panda3D, and I get this error
when compiling:

   Creating library build\temp.win32-2.6\Release\testx.lib and object
build\temp
.win32-2.6\Release\testx.exp
testc.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) pub
lic: void __thiscall Geom::clear_cache(void)" (__imp_?
clear_cache <at> Geom <at>  <at> QAEXXZ)
referenced in function "struct _object * __cdecl
__pyx_pf_5testx_test(struct _ob
ject *,struct _object *)" (?
__pyx_pf_5testx_test <at>  <at> YAPAU_object <at>  <at> PAU1 <at> 0 <at> Z)
P:\CythonCXXTest\testc\testx.pyd : fatal error LNK1120: 1 unresolved
externals
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
\BIN\link.
exe"' failed with exit status 1120

(Full output here: http://dpaste.com/238519/ )

My Cython source is:
(Continue reading)

Lisandro Dalcin | 4 Sep 20:11 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API

On 3 September 2010 19:15, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
> I believe I might be seeing this issue, but I'm not sure:
> http://trac.cython.org/cython_trac/ticket/106
>

No, your issue is unrelated.

> I'm trying to compile a trivial Cython script that makes a call into
> Panda3D's C++ API (Panda has a great python API, but it's easy to mix
> with the C++ API, which seems like a nice job for Cython). It works
> great for me on my Macs. On Windows, I have to use MSVC compiler (Form
> Visual Studio 2008 Express) to work with Panda3D, and I get this error
> when compiling:
>
>   Creating library build\temp.win32-2.6\Release\testx.lib and object
> build\temp
> .win32-2.6\Release\testx.exp
> testc.obj : error LNK2019: unresolved external symbol
> "__declspec(dllimport) pub
> lic: void __thiscall Geom::clear_cache(void)" (__imp_?
> clear_cache <at> Geom <at>  <at> QAEXXZ)
> referenced in function "struct _object * __cdecl
> __pyx_pf_5testx_test(struct _ob
> ject *,struct _object *)" (?
> __pyx_pf_5testx_test <at>  <at> YAPAU_object <at>  <at> PAU1 <at> 0 <at> Z)
> P:\CythonCXXTest\testc\testx.pyd : fatal error LNK1120: 1 unresolved
> externals
> error: command '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC
> \BIN\link.
> exe"' failed with exit status 1120
(Continue reading)

Craig Macomber | 5 Sep 04:43 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API


> Is geom.h your own code or it is a panda3d header?

It's from Panda3d. Info here along with a link to the actual header: http://www.panda3d.org/reference/cxx/class!_geom

>
> Any chance you are missing to pass 'libraries' arg to Extension
> constructor? panda3d should have a library, right?

It was unneeded on Mac, but this did fix that issue on Windows. Thanks!
Now I have a pyd file that throws a "SystemError: dynamic module not  
initialized properly" when I import it.
Any suggestions for fixing this?

Some of the warnings are worrisome, but I don't understand what they  
mean.
The full output from the build is here:

P:\CythonCXXTest\testc>ppython setup.py
running build_ext
cythoning testc.pyx to testc.cpp
building 'testc' extension
creating build
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c / 
nologo /Ox
/MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include -IC: 
\Panda3D-1.7.0\python\inclu
de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp /Fobuild 
(Continue reading)

Lisandro Dalcin | 6 Sep 03:43 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API

On 4 September 2010 23:43, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>
>> Is geom.h your own code or it is a panda3d header?
>
> It's from Panda3d. Info here along with a link to the actual header:
> http://www.panda3d.org/reference/cxx/class!_geom
>
>>
>> Any chance you are missing to pass 'libraries' arg to Extension
>> constructor? panda3d should have a library, right?
>
> It was unneeded on Mac, but this did fix that issue on Windows. Thanks!
> Now I have a pyd file that throws a "SystemError: dynamic module not
> initialized properly" when I import it.
> Any suggestions for fixing this?
>
> Some of the warnings are worrisome, but I don't understand what they mean.
> The full output from the build is here:
>
> P:\CythonCXXTest\testc>ppython setup.py
> running build_ext
> cythoning testc.pyx to testc.cpp
> building 'testc' extension
> creating build
> creating build\temp.win32-2.6
> creating build\temp.win32-2.6\Release
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
> /Ox
> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
> -IC:\Panda3D-1.7.0\python\inclu
(Continue reading)

Craig Macomber | 6 Sep 04:19 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API


C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) :
war
ning C4530: C++ exception handler used, but unwind semantics are not
enabled. Sp
ecify /EHsc

In order to remove thad warning, you could try to pass

extra_compile_args=['/EHsc']

to the Extension constructor.


Thanks. That removed that warning.


Traceback (most recent call last):
 File "setup.py", line 44, in <module>
   import testc
SystemError: dynamic module not initialized properly


Mmm... I think you did it wrong, I would try:

library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C:\Panda3D-1.7.0\lib']
libraries=['libp3framework', 'libpanda', 'libpandafx', ...]


I was missing library_dirs, so I had full paths to the libraries. Thanks for the suggestion. The code is a bit tidier now, however the error still stands.

An up to date copy of my setup.py and textc.pyx files (which is the entire project, aside from third party stuff like panda) is here: http://craig.p3dp.com/Examples/Cython/testc/
I included the build files too incase then are of any use.

Thanks again for your help!

 Output is now:

P:\CythonCXXTest\testc>ppython setup.py
running build_ext
building 'testc' extension
creating build\temp.win32-2.6
creating build\temp.win32-2.6\Release
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox
/MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include -IC:\Panda3D-1.7.0\python\inclu
de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp /Fobuild\temp.win32-2.6\Release\tes
tc.obj /EHsc
testc.cpp
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) : warn
ing C4275: non dll-interface class 'std::_Container_base_aux' used as base for d
ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
        with
        [
            _Alloc=pallocator_array<TypedWritable *>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xutility(3
77) : see declaration of 'std::_Container_base_aux'
        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class templ
ate instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=TypedWritable *,
            _Ax=pallocator_array<TypedWritable *>
        ]
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) : warn
ing C4275: non dll-interface class 'std::_Container_base_aux' used as base for d
ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
        with
        [
            _Alloc=pallocator_array<std::string>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xutility(3
77) : see declaration of 'std::_Container_base_aux'
        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class templ
ate instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=std::string,
            _Ax=pallocator_array<std::string>
        ]
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) : warn
ing C4275: non dll-interface class 'std::_Container_base_aux' used as base for d
ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
        with
        [
            _Alloc=pallocator_array<unsigned char>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xutility(3
77) : see declaration of 'std::_Container_base_aux'
        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class templ
ate instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=unsigned char,
            _Ax=pallocator_array<unsigned char>
        ]
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) : warn
ing C4275: non dll-interface class 'std::_Container_base_aux' used as base for d
ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
        with
        [
            _Alloc=pallocator_array<int>
        ]
        C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xutility(3
77) : see declaration of 'std::_Container_base_aux'
        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class templ
ate instantiation 'std::vector<_Ty,_Ax>' being compiled
        with
        [
            _Ty=int,
            _Ax=pallocator_array<int>
        ]
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs /LIBPATH:C:\Panda3D-1.7.0\
lib /LIBPATH:C:\Panda3D-1.7.0\python\libs /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
ld libp3framework.lib libpanda.lib libpandafx.lib libpandaexpress.lib libp3dtool
.lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib /EXPORT:inittestc buil
d\temp.win32-2.6\Release\testc.obj /OUT:P:\CythonCXXTest\testc\testc.pyd /IMPLIB
:build\temp.win32-2.6\Release\testc.lib /MANIFESTFILE:build\temp.win32-2.6\Relea
se\testc.pyd.manifest
   Creating library build\temp.win32-2.6\Release\testc.lib and object build\temp
.win32-2.6\Release\testc.exp
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo -manifest build
\temp.win32-2.6\Release\testc.pyd.manifest -outputresource:P:\CythonCXXTest\test
c\testc.pyd;2
Importing module
Traceback (most recent call last):
  File "setup.py", line 46, in <module>
    import testc
SystemError: dynamic module not initialized properly





--
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

Lisandro Dalcin | 6 Sep 05:02 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API

On 5 September 2010 23:19, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) :
>
> war
>
> ning C4530: C++ exception handler used, but unwind semantics are not
>
> enabled. Sp
>
> ecify /EHsc
>
> In order to remove thad warning, you could try to pass
>
> extra_compile_args=['/EHsc']
>
> to the Extension constructor.
>
>
> Thanks. That removed that warning.
>
> Traceback (most recent call last):
>
>  File "setup.py", line 44, in <module>
>
>    import testc
>
> SystemError: dynamic module not initialized properly
>
>
> Mmm... I think you did it wrong, I would try:
>
> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C:\Panda3D-1.7.0\lib']
> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>
>
> I was missing library_dirs, so I had full paths to the libraries. Thanks for
> the suggestion. The code is a bit tidier now, however the error still
> stands.
> An up to date copy of my setup.py and textc.pyx files (which is the entire
> project, aside from third party stuff like panda) is
> here: http://craig.p3dp.com/Examples/Cython/testc/
> I included the build files too incase then are of any use.
> Thanks again for your help!

About this line in the pyx file

v=geom.this

What  geom.this actually is? Any chance Panda3D Python API is
generated with SWIG? What do you get if you do 'print geom.this' in a
Python prompt? In such case, I doubt such code will ever work (at
least, it would not work with the SWIG versions I worked in the past,
let say up to 1.3.37), you will need something smarter

>  Output is now:
> P:\CythonCXXTest\testc>ppython setup.py
> running build_ext
> building 'testc' extension
> creating build\temp.win32-2.6
> creating build\temp.win32-2.6\Release
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo
> /Ox
> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
> -IC:\Panda3D-1.7.0\python\inclu
> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
> /Fobuild\temp.win32-2.6\Release\tes
> tc.obj /EHsc
> testc.cpp
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) :
> warn
> ing C4275: non dll-interface class 'std::_Container_base_aux' used as base
> for d
> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>         with
>         [
>             _Alloc=pallocator_array<TypedWritable *>
>         ]
>         C:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\INCLUDE\xutility(3
> 77) : see declaration of 'std::_Container_base_aux'
>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
> templ
> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>         with
>         [
>             _Ty=TypedWritable *,
>             _Ax=pallocator_array<TypedWritable *>
>         ]
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) :
> warn
> ing C4275: non dll-interface class 'std::_Container_base_aux' used as base
> for d
> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>         with
>         [
>             _Alloc=pallocator_array<std::string>
>         ]
>         C:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\INCLUDE\xutility(3
> 77) : see declaration of 'std::_Container_base_aux'
>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
> templ
> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>         with
>         [
>             _Ty=std::string,
>             _Ax=pallocator_array<std::string>
>         ]
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) :
> warn
> ing C4275: non dll-interface class 'std::_Container_base_aux' used as base
> for d
> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>         with
>         [
>             _Alloc=pallocator_array<unsigned char>
>         ]
>         C:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\INCLUDE\xutility(3
> 77) : see declaration of 'std::_Container_base_aux'
>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
> templ
> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>         with
>         [
>             _Ty=unsigned char,
>             _Ax=pallocator_array<unsigned char>
>         ]
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439) :
> warn
> ing C4275: non dll-interface class 'std::_Container_base_aux' used as base
> for d
> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>         with
>         [
>             _Alloc=pallocator_array<int>
>         ]
>         C:\Program Files (x86)\Microsoft Visual Studio
> 9.0\VC\INCLUDE\xutility(3
> 77) : see declaration of 'std::_Container_base_aux'
>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
> templ
> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>         with
>         [
>             _Ty=int,
>             _Ax=pallocator_array<int>
>         ]
> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
> /nologo
> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
> /LIBPATH:C:\Panda3D-1.7.0\
> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
> ld libp3framework.lib libpanda.lib libpandafx.lib libpandaexpress.lib
> libp3dtool
> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib /EXPORT:inittestc
> buil
> d\temp.win32-2.6\Release\testc.obj /OUT:P:\CythonCXXTest\testc\testc.pyd
> /IMPLIB
> :build\temp.win32-2.6\Release\testc.lib
> /MANIFESTFILE:build\temp.win32-2.6\Relea
> se\testc.pyd.manifest
>    Creating library build\temp.win32-2.6\Release\testc.lib and object
> build\temp
> .win32-2.6\Release\testc.exp
> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo -manifest
> build
> \temp.win32-2.6\Release\testc.pyd.manifest
> -outputresource:P:\CythonCXXTest\test
> c\testc.pyd;2
> Importing module
> Traceback (most recent call last):
>   File "setup.py", line 46, in <module>
>     import testc
> SystemError: dynamic module not initialized properly
>

Still not sure what that error means... Perhaps it is a
Windows-specific error? I'll have to check Python sources to figure
out where that error could came from...

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

Craig Macomber | 6 Sep 05:18 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API


On Sep 5, 2010, at 8:02 PM, Lisandro Dalcin wrote:

> On 5 September 2010 23:19, Craig Macomber <fishyfish55 <at> gmail.com>  
> wrote:
>>
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>> \xlocale(342) :
>>
>> war
>>
>> ning C4530: C++ exception handler used, but unwind semantics are not
>>
>> enabled. Sp
>>
>> ecify /EHsc
>>
>> In order to remove thad warning, you could try to pass
>>
>> extra_compile_args=['/EHsc']
>>
>> to the Extension constructor.
>>
>>
>> Thanks. That removed that warning.
>>
>> Traceback (most recent call last):
>>
>>  File "setup.py", line 44, in <module>
>>
>>    import testc
>>
>> SystemError: dynamic module not initialized properly
>>
>>
>> Mmm... I think you did it wrong, I would try:
>>
>> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C: 
>> \Panda3D-1.7.0\lib']
>> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>>
>>
>> I was missing library_dirs, so I had full paths to the libraries.  
>> Thanks for
>> the suggestion. The code is a bit tidier now, however the error still
>> stands.
>> An up to date copy of my setup.py and textc.pyx files (which is the  
>> entire
>> project, aside from third party stuff like panda) is
>> here: http://craig.p3dp.com/Examples/Cython/testc/
>> I included the build files too incase then are of any use.
>> Thanks again for your help!
>
> About this line in the pyx file
>
> v=geom.this
>
> What  geom.this actually is? Any chance Panda3D Python API is
> generated with SWIG? What do you get if you do 'print geom.this' in a
> Python prompt? In such case, I doubt such code will ever work (at
> least, it would not work with the SWIG versions I worked in the past,
> let say up to 1.3.37), you will need something smarter

It is a pointer to the C++ object as a python integer, and it does  
work on mac, so I don't see why I would be an issue on Windows.  
Panda3D's python bindings are made with SWIG (Via a very large  
collection of hand written .I files I believe). I'm not sure how the  
'this' property is implemented on all the Panda3D objects, but it does  
work. Anyway though, none of the code in my module ever runs (It fails  
to import), and the 'this' call is on the python API which I know  
works fine.

>
>>  Output is now:
>> P:\CythonCXXTest\testc>ppython setup.py
>> running build_ext
>> building 'testc' extension
>> creating build\temp.win32-2.6
>> creating build\temp.win32-2.6\Release
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe / 
>> c /nologo
>> /Ox
>> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
>> -IC:\Panda3D-1.7.0\python\inclu
>> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
>> /Fobuild\temp.win32-2.6\Release\tes
>> tc.obj /EHsc
>> testc.cpp
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>> \vector(439) :
>> warn
>> ing C4275: non dll-interface class 'std::_Container_base_aux' used  
>> as base
>> for d
>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>         with
>>         [
>>             _Alloc=pallocator_array<TypedWritable *>
>>         ]
>>         C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\INCLUDE\xutility(3
>> 77) : see declaration of 'std::_Container_base_aux'
>>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>> to class
>> templ
>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>         with
>>         [
>>             _Ty=TypedWritable *,
>>             _Ax=pallocator_array<TypedWritable *>
>>         ]
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>> \vector(439) :
>> warn
>> ing C4275: non dll-interface class 'std::_Container_base_aux' used  
>> as base
>> for d
>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>         with
>>         [
>>             _Alloc=pallocator_array<std::string>
>>         ]
>>         C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\INCLUDE\xutility(3
>> 77) : see declaration of 'std::_Container_base_aux'
>>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>> to class
>> templ
>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>         with
>>         [
>>             _Ty=std::string,
>>             _Ax=pallocator_array<std::string>
>>         ]
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>> \vector(439) :
>> warn
>> ing C4275: non dll-interface class 'std::_Container_base_aux' used  
>> as base
>> for d
>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>         with
>>         [
>>             _Alloc=pallocator_array<unsigned char>
>>         ]
>>         C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\INCLUDE\xutility(3
>> 77) : see declaration of 'std::_Container_base_aux'
>>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>> to class
>> templ
>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>         with
>>         [
>>             _Ty=unsigned char,
>>             _Ax=pallocator_array<unsigned char>
>>         ]
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>> \vector(439) :
>> warn
>> ing C4275: non dll-interface class 'std::_Container_base_aux' used  
>> as base
>> for d
>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>         with
>>         [
>>             _Alloc=pallocator_array<int>
>>         ]
>>         C:\Program Files (x86)\Microsoft Visual Studio
>> 9.0\VC\INCLUDE\xutility(3
>> 77) : see declaration of 'std::_Container_base_aux'
>>         c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>> to class
>> templ
>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>         with
>>         [
>>             _Ty=int,
>>             _Ax=pallocator_array<int>
>>         ]
>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe / 
>> DLL
>> /nologo
>> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
>> /LIBPATH:C:\Panda3D-1.7.0\
>> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
>> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
>> ld libp3framework.lib libpanda.lib libpandafx.lib libpandaexpress.lib
>> libp3dtool
>> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib / 
>> EXPORT:inittestc
>> buil
>> d\temp.win32-2.6\Release\testc.obj /OUT:P:\CythonCXXTest\testc 
>> \testc.pyd
>> /IMPLIB
>> :build\temp.win32-2.6\Release\testc.lib
>> /MANIFESTFILE:build\temp.win32-2.6\Relea
>> se\testc.pyd.manifest
>>    Creating library build\temp.win32-2.6\Release\testc.lib and object
>> build\temp
>> .win32-2.6\Release\testc.exp
>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo - 
>> manifest
>> build
>> \temp.win32-2.6\Release\testc.pyd.manifest
>> -outputresource:P:\CythonCXXTest\test
>> c\testc.pyd;2
>> Importing module
>> Traceback (most recent call last):
>>   File "setup.py", line 46, in <module>
>>     import testc
>> SystemError: dynamic module not initialized properly
>>
>
> Still not sure what that error means... Perhaps it is a
> Windows-specific error? I'll have to check Python sources to figure
> out where that error could came from...
>
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169

Lisandro Dalcin | 6 Sep 16:07 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API

On 6 September 2010 00:18, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>
> On Sep 5, 2010, at 8:02 PM, Lisandro Dalcin wrote:
>
>> On 5 September 2010 23:19, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>>>
>>> C:\Program Files (x86)\Microsoft Visual Studio
>>> 9.0\VC\INCLUDE\xlocale(342) :
>>>
>>> war
>>>
>>> ning C4530: C++ exception handler used, but unwind semantics are not
>>>
>>> enabled. Sp
>>>
>>> ecify /EHsc
>>>
>>> In order to remove thad warning, you could try to pass
>>>
>>> extra_compile_args=['/EHsc']
>>>
>>> to the Extension constructor.
>>>
>>>
>>> Thanks. That removed that warning.
>>>
>>> Traceback (most recent call last):
>>>
>>>  File "setup.py", line 44, in <module>
>>>
>>>   import testc
>>>
>>> SystemError: dynamic module not initialized properly
>>>
>>>
>>> Mmm... I think you did it wrong, I would try:
>>>
>>> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C:\Panda3D-1.7.0\lib']
>>> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>>>
>>>
>>> I was missing library_dirs, so I had full paths to the libraries. Thanks
>>> for
>>> the suggestion. The code is a bit tidier now, however the error still
>>> stands.
>>> An up to date copy of my setup.py and textc.pyx files (which is the
>>> entire
>>> project, aside from third party stuff like panda) is
>>> here: http://craig.p3dp.com/Examples/Cython/testc/
>>> I included the build files too incase then are of any use.
>>> Thanks again for your help!
>>
>> About this line in the pyx file
>>
>> v=geom.this
>>
>> What  geom.this actually is? Any chance Panda3D Python API is
>> generated with SWIG? What do you get if you do 'print geom.this' in a
>> Python prompt? In such case, I doubt such code will ever work (at
>> least, it would not work with the SWIG versions I worked in the past,
>> let say up to 1.3.37), you will need something smarter
>
> It is a pointer to the C++ object as a python integer, and it does work on
> mac, so I don't see why I would be an issue on Windows. Panda3D's python
> bindings are made with SWIG (Via a very large collection of hand written .I
> files I believe). I'm not sure how the 'this' property is implemented on all
> the Panda3D objects, but it does work. Anyway though, none of the code in my
> module ever runs (It fails to import), and the 'this' call is on the python
> API which I know works fine.
>
>
>
>>
>>>  Output is now:
>>> P:\CythonCXXTest\testc>ppython setup.py
>>> running build_ext
>>> building 'testc' extension
>>> creating build\temp.win32-2.6
>>> creating build\temp.win32-2.6\Release
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c
>>> /nologo
>>> /Ox
>>> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
>>> -IC:\Panda3D-1.7.0\python\inclu
>>> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
>>> /Fobuild\temp.win32-2.6\Release\tes
>>> tc.obj /EHsc
>>> testc.cpp
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439)
>>> :
>>> warn
>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>> base
>>> for d
>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>        with
>>>        [
>>>            _Alloc=pallocator_array<TypedWritable *>
>>>        ]
>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>> 9.0\VC\INCLUDE\xutility(3
>>> 77) : see declaration of 'std::_Container_base_aux'
>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
>>> templ
>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>        with
>>>        [
>>>            _Ty=TypedWritable *,
>>>            _Ax=pallocator_array<TypedWritable *>
>>>        ]
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439)
>>> :
>>> warn
>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>> base
>>> for d
>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>        with
>>>        [
>>>            _Alloc=pallocator_array<std::string>
>>>        ]
>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>> 9.0\VC\INCLUDE\xutility(3
>>> 77) : see declaration of 'std::_Container_base_aux'
>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
>>> templ
>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>        with
>>>        [
>>>            _Ty=std::string,
>>>            _Ax=pallocator_array<std::string>
>>>        ]
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439)
>>> :
>>> warn
>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>> base
>>> for d
>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>        with
>>>        [
>>>            _Alloc=pallocator_array<unsigned char>
>>>        ]
>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>> 9.0\VC\INCLUDE\xutility(3
>>> 77) : see declaration of 'std::_Container_base_aux'
>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
>>> templ
>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>        with
>>>        [
>>>            _Ty=unsigned char,
>>>            _Ax=pallocator_array<unsigned char>
>>>        ]
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\vector(439)
>>> :
>>> warn
>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>> base
>>> for d
>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>        with
>>>        [
>>>            _Alloc=pallocator_array<int>
>>>        ]
>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>> 9.0\VC\INCLUDE\xutility(3
>>> 77) : see declaration of 'std::_Container_base_aux'
>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to class
>>> templ
>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>        with
>>>        [
>>>            _Ty=int,
>>>            _Ax=pallocator_array<int>
>>>        ]
>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
>>> /nologo
>>> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>> /LIBPATH:C:\Panda3D-1.7.0\
>>> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
>>> ld libp3framework.lib libpanda.lib libpandafx.lib libpandaexpress.lib
>>> libp3dtool
>>> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib
>>> /EXPORT:inittestc
>>> buil
>>> d\temp.win32-2.6\Release\testc.obj /OUT:P:\CythonCXXTest\testc\testc.pyd
>>> /IMPLIB
>>> :build\temp.win32-2.6\Release\testc.lib
>>> /MANIFESTFILE:build\temp.win32-2.6\Relea
>>> se\testc.pyd.manifest
>>>   Creating library build\temp.win32-2.6\Release\testc.lib and object
>>> build\temp
>>> .win32-2.6\Release\testc.exp
>>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo
>>> -manifest
>>> build
>>> \temp.win32-2.6\Release\testc.pyd.manifest
>>> -outputresource:P:\CythonCXXTest\test
>>> c\testc.pyd;2
>>> Importing module
>>> Traceback (most recent call last):
>>>  File "setup.py", line 46, in <module>
>>>    import testc
>>> SystemError: dynamic module not initialized properly
>>>
>>
>> Still not sure what that error means... Perhaps it is a
>> Windows-specific error? I'll have to check Python sources to figure
>> out where that error could came from...
>>
>> --
>> Lisandro Dalcin
>> ---------------
>> CIMEC (INTEC/CONICET-UNL)
>> Predio CONICET-Santa Fe
>> Colectora RN 168 Km 472, Paraje El Pozo
>> Tel: +54-342-4511594 (ext 1011)
>> Tel/Fax: +54-342-4511169
>
>

Does Panda3D exports a C API for writing Python extension modules, for
example like NumPy? In such case, could you point me to such docs?
Perhaps you have to make a import_panda3d() call at the very beginning
of your Cython code?

Do you have any example of a hand-written Python ext module using the
Panda3D API?

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

Craig Macomber | 6 Sep 23:48 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API


On Sep 6, 2010, at 7:07 AM, Lisandro Dalcin wrote:

> On 6 September 2010 00:18, Craig Macomber <fishyfish55 <at> gmail.com>  
> wrote:
>>
>> On Sep 5, 2010, at 8:02 PM, Lisandro Dalcin wrote:
>>
>>> On 5 September 2010 23:19, Craig Macomber <fishyfish55 <at> gmail.com>  
>>> wrote:
>>>>
>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>> 9.0\VC\INCLUDE\xlocale(342) :
>>>>
>>>> war
>>>>
>>>> ning C4530: C++ exception handler used, but unwind semantics are  
>>>> not
>>>>
>>>> enabled. Sp
>>>>
>>>> ecify /EHsc
>>>>
>>>> In order to remove thad warning, you could try to pass
>>>>
>>>> extra_compile_args=['/EHsc']
>>>>
>>>> to the Extension constructor.
>>>>
>>>>
>>>> Thanks. That removed that warning.
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>  File "setup.py", line 44, in <module>
>>>>
>>>>   import testc
>>>>
>>>> SystemError: dynamic module not initialized properly
>>>>
>>>>
>>>> Mmm... I think you did it wrong, I would try:
>>>>
>>>> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C: 
>>>> \Panda3D-1.7.0\lib']
>>>> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>>>>
>>>>
>>>> I was missing library_dirs, so I had full paths to the libraries.  
>>>> Thanks
>>>> for
>>>> the suggestion. The code is a bit tidier now, however the error  
>>>> still
>>>> stands.
>>>> An up to date copy of my setup.py and textc.pyx files (which is the
>>>> entire
>>>> project, aside from third party stuff like panda) is
>>>> here: http://craig.p3dp.com/Examples/Cython/testc/
>>>> I included the build files too incase then are of any use.
>>>> Thanks again for your help!
>>>
>>> About this line in the pyx file
>>>
>>> v=geom.this
>>>
>>> What  geom.this actually is? Any chance Panda3D Python API is
>>> generated with SWIG? What do you get if you do 'print geom.this'  
>>> in a
>>> Python prompt? In such case, I doubt such code will ever work (at
>>> least, it would not work with the SWIG versions I worked in the  
>>> past,
>>> let say up to 1.3.37), you will need something smarter
>>
>> It is a pointer to the C++ object as a python integer, and it does  
>> work on
>> mac, so I don't see why I would be an issue on Windows. Panda3D's  
>> python
>> bindings are made with SWIG (Via a very large collection of hand  
>> written .I
>> files I believe). I'm not sure how the 'this' property is  
>> implemented on all
>> the Panda3D objects, but it does work. Anyway though, none of the  
>> code in my
>> module ever runs (It fails to import), and the 'this' call is on  
>> the python
>> API which I know works fine.
>>
>>
>>
>>>
>>>>  Output is now:
>>>> P:\CythonCXXTest\testc>ppython setup.py
>>>> running build_ext
>>>> building 'testc' extension
>>>> creating build\temp.win32-2.6
>>>> creating build\temp.win32-2.6\Release
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c
>>>> /nologo
>>>> /Ox
>>>> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
>>>> -IC:\Panda3D-1.7.0\python\inclu
>>>> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
>>>> /Fobuild\temp.win32-2.6\Release\tes
>>>> tc.obj /EHsc
>>>> testc.cpp
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>>>> \vector(439)
>>>> :
>>>> warn
>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>> used as
>>>> base
>>>> for d
>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>        with
>>>>        [
>>>>            _Alloc=pallocator_array<TypedWritable *>
>>>>        ]
>>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>>> 9.0\VC\INCLUDE\xutility(3
>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>> to class
>>>> templ
>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>        with
>>>>        [
>>>>            _Ty=TypedWritable *,
>>>>            _Ax=pallocator_array<TypedWritable *>
>>>>        ]
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>>>> \vector(439)
>>>> :
>>>> warn
>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>> used as
>>>> base
>>>> for d
>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>        with
>>>>        [
>>>>            _Alloc=pallocator_array<std::string>
>>>>        ]
>>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>>> 9.0\VC\INCLUDE\xutility(3
>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>> to class
>>>> templ
>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>        with
>>>>        [
>>>>            _Ty=std::string,
>>>>            _Ax=pallocator_array<std::string>
>>>>        ]
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>>>> \vector(439)
>>>> :
>>>> warn
>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>> used as
>>>> base
>>>> for d
>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>        with
>>>>        [
>>>>            _Alloc=pallocator_array<unsigned char>
>>>>        ]
>>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>>> 9.0\VC\INCLUDE\xutility(3
>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>> to class
>>>> templ
>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>        with
>>>>        [
>>>>            _Ty=unsigned char,
>>>>            _Ax=pallocator_array<unsigned char>
>>>>        ]
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE 
>>>> \vector(439)
>>>> :
>>>> warn
>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>> used as
>>>> base
>>>> for d
>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>        with
>>>>        [
>>>>            _Alloc=pallocator_array<int>
>>>>        ]
>>>>        C:\Program Files (x86)\Microsoft Visual Studio
>>>> 9.0\VC\INCLUDE\xutility(3
>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>        c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>> to class
>>>> templ
>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>        with
>>>>        [
>>>>            _Ty=int,
>>>>            _Ax=pallocator_array<int>
>>>>        ]
>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN 
>>>> \link.exe /DLL
>>>> /nologo
>>>> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>> /LIBPATH:C:\Panda3D-1.7.0\
>>>> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
>>>> ld libp3framework.lib libpanda.lib libpandafx.lib  
>>>> libpandaexpress.lib
>>>> libp3dtool
>>>> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib
>>>> /EXPORT:inittestc
>>>> buil
>>>> d\temp.win32-2.6\Release\testc.obj /OUT:P:\CythonCXXTest\testc 
>>>> \testc.pyd
>>>> /IMPLIB
>>>> :build\temp.win32-2.6\Release\testc.lib
>>>> /MANIFESTFILE:build\temp.win32-2.6\Relea
>>>> se\testc.pyd.manifest
>>>>   Creating library build\temp.win32-2.6\Release\testc.lib and  
>>>> object
>>>> build\temp
>>>> .win32-2.6\Release\testc.exp
>>>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo
>>>> -manifest
>>>> build
>>>> \temp.win32-2.6\Release\testc.pyd.manifest
>>>> -outputresource:P:\CythonCXXTest\test
>>>> c\testc.pyd;2
>>>> Importing module
>>>> Traceback (most recent call last):
>>>>  File "setup.py", line 46, in <module>
>>>>    import testc
>>>> SystemError: dynamic module not initialized properly
>>>>
>>>
>>> Still not sure what that error means... Perhaps it is a
>>> Windows-specific error? I'll have to check Python sources to figure
>>> out where that error could came from...
>>>
>>> --
>>> Lisandro Dalcin
>>> ---------------
>>> CIMEC (INTEC/CONICET-UNL)
>>> Predio CONICET-Santa Fe
>>> Colectora RN 168 Km 472, Paraje El Pozo
>>> Tel: +54-342-4511594 (ext 1011)
>>> Tel/Fax: +54-342-4511169
>>
>>
>
> Does Panda3D exports a C API for writing Python extension modules, for
> example like NumPy? In such case, could you point me to such docs?
> Perhaps you have to make a import_panda3d() call at the very beginning
> of your Cython code?

I'm not very knowledgeable about such things, but I believe Panda3d  
just has a C++ API, and a Python API. There is a language reference  
for each, and all the manual pages have a toggle link at the top to  
switch between Python and C++. Docs are at http://www.panda3d.org/documentation.php

My extension module I'm making is imported from a python module (in  
this case my setup.py) after importing the python modules which  
corresponds to the C++ modules the code needs to have loaded. This  
worked on mac, but on mac, I also didn't need to list the libraries,  
so it may be somewhat different as to what initialization is required  
before loading the module.

I get the feeling that whatever is in the body of my Cython code is  
not useful for the initializing at all as I get this error befor the  
first line in my Cython code runs (I tried putting a print at the very  
top). The only relevant things as far as I can tell are the externs,  
and compile settngs, and the initilization done before importing the  
Cython module (such as panda3d imports from python).

On Mac, if I don't import the proper modules from panda before  
importing my Cython one, I get this:
ImportError: dlopen(/somePathHere/testc.so, 2): Symbol not found:  
__ZTI11TypedObject
   Referenced from: /somePathHere/testc.so
   Expected in: dynamic lookup

That is significantly different from the error I get on Windows, so I  
assumed it's a different issue.

For the sake of simplicity, I can reduce my Cython code to just the  
one line 'cdef extern from "geom.h": pass' with no change in behavior  
on Windows.

>
> Do you have any example of a hand-written Python ext module using the
> Panda3D API?
>

I have a large collection of Cython modules that use the Panda's  
Python API, and one C extension module that I used with panda but does  
not use its API. Most panda users just seem to either code in pure  
python, or pure C++, so I can't find any actual python extension  
modules that call Panda directly.

I know C (somewhat), but I don't know enough C++ to try and write one  
that does anything, but if it would be useful, I can try and scrap  
together a minimal C++ python extension module and stick the Panda3D C+ 
+ hello world sample in it ( http://www.panda3d.org/manual/index.php/The_Window_Framework 
  (see the C++ version of that page) ), then try and make one closer  
to what I'm trying to do (assume Panda is already setup properly and  
make some call). Also, I could try editing the generated C++ file, or  
just try and run a panda3d C++ project on Windows to make sure the  
compiler it working with Panda properly (I've never actually written a  
C++ project of any kind, much less run one one on Windows). What do  
you think would be most useful for me to try?

Thanks!

>
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169

Lisandro Dalcin | 6 Sep 23:56 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API

On 6 September 2010 18:48, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>
> On Sep 6, 2010, at 7:07 AM, Lisandro Dalcin wrote:
>
>> On 6 September 2010 00:18, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>>>
>>> On Sep 5, 2010, at 8:02 PM, Lisandro Dalcin wrote:
>>>
>>>> On 5 September 2010 23:19, Craig Macomber <fishyfish55 <at> gmail.com> wrote:
>>>>>
>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\xlocale(342) :
>>>>>
>>>>> war
>>>>>
>>>>> ning C4530: C++ exception handler used, but unwind semantics are not
>>>>>
>>>>> enabled. Sp
>>>>>
>>>>> ecify /EHsc
>>>>>
>>>>> In order to remove thad warning, you could try to pass
>>>>>
>>>>> extra_compile_args=['/EHsc']
>>>>>
>>>>> to the Extension constructor.
>>>>>
>>>>>
>>>>> Thanks. That removed that warning.
>>>>>
>>>>> Traceback (most recent call last):
>>>>>
>>>>>  File "setup.py", line 44, in <module>
>>>>>
>>>>>  import testc
>>>>>
>>>>> SystemError: dynamic module not initialized properly
>>>>>
>>>>>
>>>>> Mmm... I think you did it wrong, I would try:
>>>>>
>>>>> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C:\Panda3D-1.7.0\lib']
>>>>> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>>>>>
>>>>>
>>>>> I was missing library_dirs, so I had full paths to the libraries.
>>>>> Thanks
>>>>> for
>>>>> the suggestion. The code is a bit tidier now, however the error still
>>>>> stands.
>>>>> An up to date copy of my setup.py and textc.pyx files (which is the
>>>>> entire
>>>>> project, aside from third party stuff like panda) is
>>>>> here: http://craig.p3dp.com/Examples/Cython/testc/
>>>>> I included the build files too incase then are of any use.
>>>>> Thanks again for your help!
>>>>
>>>> About this line in the pyx file
>>>>
>>>> v=geom.this
>>>>
>>>> What  geom.this actually is? Any chance Panda3D Python API is
>>>> generated with SWIG? What do you get if you do 'print geom.this' in a
>>>> Python prompt? In such case, I doubt such code will ever work (at
>>>> least, it would not work with the SWIG versions I worked in the past,
>>>> let say up to 1.3.37), you will need something smarter
>>>
>>> It is a pointer to the C++ object as a python integer, and it does work
>>> on
>>> mac, so I don't see why I would be an issue on Windows. Panda3D's python
>>> bindings are made with SWIG (Via a very large collection of hand written
>>> .I
>>> files I believe). I'm not sure how the 'this' property is implemented on
>>> all
>>> the Panda3D objects, but it does work. Anyway though, none of the code in
>>> my
>>> module ever runs (It fails to import), and the 'this' call is on the
>>> python
>>> API which I know works fine.
>>>
>>>
>>>
>>>>
>>>>>  Output is now:
>>>>> P:\CythonCXXTest\testc>ppython setup.py
>>>>> running build_ext
>>>>> building 'testc' extension
>>>>> creating build\temp.win32-2.6
>>>>> creating build\temp.win32-2.6\Release
>>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c
>>>>> /nologo
>>>>> /Ox
>>>>> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
>>>>> -IC:\Panda3D-1.7.0\python\inclu
>>>>> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
>>>>> /Fobuild\temp.win32-2.6\Release\tes
>>>>> tc.obj /EHsc
>>>>> testc.cpp
>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>> :
>>>>> warn
>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>>>> base
>>>>> for d
>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>       with
>>>>>       [
>>>>>           _Alloc=pallocator_array<TypedWritable *>
>>>>>       ]
>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to
>>>>> class
>>>>> templ
>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>       with
>>>>>       [
>>>>>           _Ty=TypedWritable *,
>>>>>           _Ax=pallocator_array<TypedWritable *>
>>>>>       ]
>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>> :
>>>>> warn
>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>>>> base
>>>>> for d
>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>       with
>>>>>       [
>>>>>           _Alloc=pallocator_array<std::string>
>>>>>       ]
>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to
>>>>> class
>>>>> templ
>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>       with
>>>>>       [
>>>>>           _Ty=std::string,
>>>>>           _Ax=pallocator_array<std::string>
>>>>>       ]
>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>> :
>>>>> warn
>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>>>> base
>>>>> for d
>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>       with
>>>>>       [
>>>>>           _Alloc=pallocator_array<unsigned char>
>>>>>       ]
>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to
>>>>> class
>>>>> templ
>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>       with
>>>>>       [
>>>>>           _Ty=unsigned char,
>>>>>           _Ax=pallocator_array<unsigned char>
>>>>>       ]
>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>> :
>>>>> warn
>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux' used as
>>>>> base
>>>>> for d
>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>       with
>>>>>       [
>>>>>           _Alloc=pallocator_array<int>
>>>>>       ]
>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference to
>>>>> class
>>>>> templ
>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>       with
>>>>>       [
>>>>>           _Ty=int,
>>>>>           _Ax=pallocator_array<int>
>>>>>       ]
>>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\link.exe /DLL
>>>>> /nologo
>>>>> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>>> /LIBPATH:C:\Panda3D-1.7.0\
>>>>> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>>> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
>>>>> ld libp3framework.lib libpanda.lib libpandafx.lib libpandaexpress.lib
>>>>> libp3dtool
>>>>> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib
>>>>> /EXPORT:inittestc
>>>>> buil
>>>>> d\temp.win32-2.6\Release\testc.obj
>>>>> /OUT:P:\CythonCXXTest\testc\testc.pyd
>>>>> /IMPLIB
>>>>> :build\temp.win32-2.6\Release\testc.lib
>>>>> /MANIFESTFILE:build\temp.win32-2.6\Relea
>>>>> se\testc.pyd.manifest
>>>>>  Creating library build\temp.win32-2.6\Release\testc.lib and object
>>>>> build\temp
>>>>> .win32-2.6\Release\testc.exp
>>>>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo
>>>>> -manifest
>>>>> build
>>>>> \temp.win32-2.6\Release\testc.pyd.manifest
>>>>> -outputresource:P:\CythonCXXTest\test
>>>>> c\testc.pyd;2
>>>>> Importing module
>>>>> Traceback (most recent call last):
>>>>>  File "setup.py", line 46, in <module>
>>>>>   import testc
>>>>> SystemError: dynamic module not initialized properly
>>>>>
>>>>
>>>> Still not sure what that error means... Perhaps it is a
>>>> Windows-specific error? I'll have to check Python sources to figure
>>>> out where that error could came from...
>>>>
>>>> --
>>>> Lisandro Dalcin
>>>> ---------------
>>>> CIMEC (INTEC/CONICET-UNL)
>>>> Predio CONICET-Santa Fe
>>>> Colectora RN 168 Km 472, Paraje El Pozo
>>>> Tel: +54-342-4511594 (ext 1011)
>>>> Tel/Fax: +54-342-4511169
>>>
>>>
>>
>> Does Panda3D exports a C API for writing Python extension modules, for
>> example like NumPy? In such case, could you point me to such docs?
>> Perhaps you have to make a import_panda3d() call at the very beginning
>> of your Cython code?
>
> I'm not very knowledgeable about such things, but I believe Panda3d just has
> a C++ API, and a Python API. There is a language reference for each, and all
> the manual pages have a toggle link at the top to switch between Python and
> C++. Docs are at http://www.panda3d.org/documentation.php
>
> My extension module I'm making is imported from a python module (in this
> case my setup.py) after importing the python modules which corresponds to
> the C++ modules the code needs to have loaded. This worked on mac, but on
> mac, I also didn't need to list the libraries, so it may be somewhat
> different as to what initialization is required before loading the module.
>
> I get the feeling that whatever is in the body of my Cython code is not
> useful for the initializing at all as I get this error befor the first line
> in my Cython code runs (I tried putting a print at the very top). The only
> relevant things as far as I can tell are the externs, and compile settngs,
> and the initilization done before importing the Cython module (such as
> panda3d imports from python).
>
> On Mac, if I don't import the proper modules from panda before importing my
> Cython one, I get this:
> ImportError: dlopen(/somePathHere/testc.so, 2): Symbol not found:
> __ZTI11TypedObject
>  Referenced from: /somePathHere/testc.so
>  Expected in: dynamic lookup
>

I think there is the root of the issue.

>
> That is significantly different from the error I get on Windows, so I
> assumed it's a different issue.
>

You are in a different OS, so a different error should be expected
:-). The dynamic linking semantics in OS X (and POSIX systems in
general) are rather different...

Please, go to you Mac and figure out where the TypedObject symbol comes from.

--

-- 
Lisandro Dalcin
---------------
CIMEC (INTEC/CONICET-UNL)
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

Craig Macomber | 7 Sep 02:15 2010
Picon

Re: "unresolved external symbol" On Windows trying to call Panda3D's C++ API


On Sep 6, 2010, at 2:56 PM, Lisandro Dalcin wrote:

> On 6 September 2010 18:48, Craig Macomber <fishyfish55 <at> gmail.com>  
> wrote:
>>
>> On Sep 6, 2010, at 7:07 AM, Lisandro Dalcin wrote:
>>
>>> On 6 September 2010 00:18, Craig Macomber <fishyfish55 <at> gmail.com>  
>>> wrote:
>>>>
>>>> On Sep 5, 2010, at 8:02 PM, Lisandro Dalcin wrote:
>>>>
>>>>> On 5 September 2010 23:19, Craig Macomber  
>>>>> <fishyfish55 <at> gmail.com> wrote:
>>>>>>
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\xlocale(342) :
>>>>>>
>>>>>> war
>>>>>>
>>>>>> ning C4530: C++ exception handler used, but unwind semantics  
>>>>>> are not
>>>>>>
>>>>>> enabled. Sp
>>>>>>
>>>>>> ecify /EHsc
>>>>>>
>>>>>> In order to remove thad warning, you could try to pass
>>>>>>
>>>>>> extra_compile_args=['/EHsc']
>>>>>>
>>>>>> to the Extension constructor.
>>>>>>
>>>>>>
>>>>>> Thanks. That removed that warning.
>>>>>>
>>>>>> Traceback (most recent call last):
>>>>>>
>>>>>>  File "setup.py", line 44, in <module>
>>>>>>
>>>>>>  import testc
>>>>>>
>>>>>> SystemError: dynamic module not initialized properly
>>>>>>
>>>>>>
>>>>>> Mmm... I think you did it wrong, I would try:
>>>>>>
>>>>>> library_dirs=[r'C:\Panda3D-1.7.0\python\libs', r'C: 
>>>>>> \Panda3D-1.7.0\lib']
>>>>>> libraries=['libp3framework', 'libpanda', 'libpandafx', ...]
>>>>>>
>>>>>>
>>>>>> I was missing library_dirs, so I had full paths to the libraries.
>>>>>> Thanks
>>>>>> for
>>>>>> the suggestion. The code is a bit tidier now, however the error  
>>>>>> still
>>>>>> stands.
>>>>>> An up to date copy of my setup.py and textc.pyx files (which is  
>>>>>> the
>>>>>> entire
>>>>>> project, aside from third party stuff like panda) is
>>>>>> here: http://craig.p3dp.com/Examples/Cython/testc/
>>>>>> I included the build files too incase then are of any use.
>>>>>> Thanks again for your help!
>>>>>
>>>>> About this line in the pyx file
>>>>>
>>>>> v=geom.this
>>>>>
>>>>> What  geom.this actually is? Any chance Panda3D Python API is
>>>>> generated with SWIG? What do you get if you do 'print geom.this'  
>>>>> in a
>>>>> Python prompt? In such case, I doubt such code will ever work (at
>>>>> least, it would not work with the SWIG versions I worked in the  
>>>>> past,
>>>>> let say up to 1.3.37), you will need something smarter
>>>>
>>>> It is a pointer to the C++ object as a python integer, and it  
>>>> does work
>>>> on
>>>> mac, so I don't see why I would be an issue on Windows. Panda3D's  
>>>> python
>>>> bindings are made with SWIG (Via a very large collection of hand  
>>>> written
>>>> .I
>>>> files I believe). I'm not sure how the 'this' property is  
>>>> implemented on
>>>> all
>>>> the Panda3D objects, but it does work. Anyway though, none of the  
>>>> code in
>>>> my
>>>> module ever runs (It fails to import), and the 'this' call is on  
>>>> the
>>>> python
>>>> API which I know works fine.
>>>>
>>>>
>>>>
>>>>>
>>>>>>  Output is now:
>>>>>> P:\CythonCXXTest\testc>ppython setup.py
>>>>>> running build_ext
>>>>>> building 'testc' extension
>>>>>> creating build\temp.win32-2.6
>>>>>> creating build\temp.win32-2.6\Release
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN 
>>>>>> \cl.exe /c
>>>>>> /nologo
>>>>>> /Ox
>>>>>> /MD /W3 /GS- /DNDEBUG -IC:\Panda3D-1.7.0\include
>>>>>> -IC:\Panda3D-1.7.0\python\inclu
>>>>>> de -IC:\Panda3D-1.7.0\python\PC /Tptestc.cpp
>>>>>> /Fobuild\temp.win32-2.6\Release\tes
>>>>>> tc.obj /EHsc
>>>>>> testc.cpp
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>>> :
>>>>>> warn
>>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>>>> used as
>>>>>> base
>>>>>> for d
>>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>>       with
>>>>>>       [
>>>>>>           _Alloc=pallocator_array<TypedWritable *>
>>>>>>       ]
>>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>>>> to
>>>>>> class
>>>>>> templ
>>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>>       with
>>>>>>       [
>>>>>>           _Ty=TypedWritable *,
>>>>>>           _Ax=pallocator_array<TypedWritable *>
>>>>>>       ]
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>>> :
>>>>>> warn
>>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>>>> used as
>>>>>> base
>>>>>> for d
>>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>>       with
>>>>>>       [
>>>>>>           _Alloc=pallocator_array<std::string>
>>>>>>       ]
>>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>>>> to
>>>>>> class
>>>>>> templ
>>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>>       with
>>>>>>       [
>>>>>>           _Ty=std::string,
>>>>>>           _Ax=pallocator_array<std::string>
>>>>>>       ]
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>>> :
>>>>>> warn
>>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>>>> used as
>>>>>> base
>>>>>> for d
>>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>>       with
>>>>>>       [
>>>>>>           _Alloc=pallocator_array<unsigned char>
>>>>>>       ]
>>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>>>> to
>>>>>> class
>>>>>> templ
>>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>>       with
>>>>>>       [
>>>>>>           _Ty=unsigned char,
>>>>>>           _Ax=pallocator_array<unsigned char>
>>>>>>       ]
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\vector(439)
>>>>>> :
>>>>>> warn
>>>>>> ing C4275: non dll-interface class 'std::_Container_base_aux'  
>>>>>> used as
>>>>>> base
>>>>>> for d
>>>>>> ll-interface class 'std::_Container_base_aux_alloc_real<_Alloc>'
>>>>>>       with
>>>>>>       [
>>>>>>           _Alloc=pallocator_array<int>
>>>>>>       ]
>>>>>>       C:\Program Files (x86)\Microsoft Visual Studio
>>>>>> 9.0\VC\INCLUDE\xutility(3
>>>>>> 77) : see declaration of 'std::_Container_base_aux'
>>>>>>       c:\panda3d-1.7.0\include\vector_src.h(64) : see reference  
>>>>>> to
>>>>>> class
>>>>>> templ
>>>>>> ate instantiation 'std::vector<_Ty,_Ax>' being compiled
>>>>>>       with
>>>>>>       [
>>>>>>           _Ty=int,
>>>>>>           _Ax=pallocator_array<int>
>>>>>>       ]
>>>>>> C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN 
>>>>>> \link.exe /DLL
>>>>>> /nologo
>>>>>> /INCREMENTAL:NO /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>>>> /LIBPATH:C:\Panda3D-1.7.0\
>>>>>> lib /LIBPATH:C:\Panda3D-1.7.0\python\libs
>>>>>> /LIBPATH:C:\Panda3D-1.7.0\python\PCbui
>>>>>> ld libp3framework.lib libpanda.lib libpandafx.lib  
>>>>>> libpandaexpress.lib
>>>>>> libp3dtool
>>>>>> .lib libp3dtoolconfig.lib libp3pystub.lib libp3direct.lib
>>>>>> /EXPORT:inittestc
>>>>>> buil
>>>>>> d\temp.win32-2.6\Release\testc.obj
>>>>>> /OUT:P:\CythonCXXTest\testc\testc.pyd
>>>>>> /IMPLIB
>>>>>> :build\temp.win32-2.6\Release\testc.lib
>>>>>> /MANIFESTFILE:build\temp.win32-2.6\Relea
>>>>>> se\testc.pyd.manifest
>>>>>>  Creating library build\temp.win32-2.6\Release\testc.lib and  
>>>>>> object
>>>>>> build\temp
>>>>>> .win32-2.6\Release\testc.exp
>>>>>> C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\mt.exe -nologo
>>>>>> -manifest
>>>>>> build
>>>>>> \temp.win32-2.6\Release\testc.pyd.manifest
>>>>>> -outputresource:P:\CythonCXXTest\test
>>>>>> c\testc.pyd;2
>>>>>> Importing module
>>>>>> Traceback (most recent call last):
>>>>>>  File "setup.py", line 46, in <module>
>>>>>>   import testc
>>>>>> SystemError: dynamic module not initialized properly
>>>>>>
>>>>>
>>>>> Still not sure what that error means... Perhaps it is a
>>>>> Windows-specific error? I'll have to check Python sources to  
>>>>> figure
>>>>> out where that error could came from...
>>>>>
>>>>> --
>>>>> Lisandro Dalcin
>>>>> ---------------
>>>>> CIMEC (INTEC/CONICET-UNL)
>>>>> Predio CONICET-Santa Fe
>>>>> Colectora RN 168 Km 472, Paraje El Pozo
>>>>> Tel: +54-342-4511594 (ext 1011)
>>>>> Tel/Fax: +54-342-4511169
>>>>
>>>>
>>>
>>> Does Panda3D exports a C API for writing Python extension modules,  
>>> for
>>> example like NumPy? In such case, could you point me to such docs?
>>> Perhaps you have to make a import_panda3d() call at the very  
>>> beginning
>>> of your Cython code?
>>
>> I'm not very knowledgeable about such things, but I believe Panda3d  
>> just has
>> a C++ API, and a Python API. There is a language reference for  
>> each, and all
>> the manual pages have a toggle link at the top to switch between  
>> Python and
>> C++. Docs are at http://www.panda3d.org/documentation.php
>>
>> My extension module I'm making is imported from a python module (in  
>> this
>> case my setup.py) after importing the python modules which  
>> corresponds to
>> the C++ modules the code needs to have loaded. This worked on mac,  
>> but on
>> mac, I also didn't need to list the libraries, so it may be somewhat
>> different as to what initialization is required before loading the  
>> module.
>>
>> I get the feeling that whatever is in the body of my Cython code is  
>> not
>> useful for the initializing at all as I get this error befor the  
>> first line
>> in my Cython code runs (I tried putting a print at the very top).  
>> The only
>> relevant things as far as I can tell are the externs, and compile  
>> settngs,
>> and the initilization done before importing the Cython module (such  
>> as
>> panda3d imports from python).
>>
>> On Mac, if I don't import the proper modules from panda before  
>> importing my
>> Cython one, I get this:
>> ImportError: dlopen(/somePathHere/testc.so, 2): Symbol not found:
>> __ZTI11TypedObject
>>  Referenced from: /somePathHere/testc.so
>>  Expected in: dynamic lookup
>>
>
> I think there is the root of the issue.

I fixed that issue by importing the appropriate modules in python, or  
so I thought.  (In this case with 'from panda3d.core import Geom' )
I got it to work on Windows now! Panda3D's python package package  
implements a lazy loading setup, so my attempts to force all the  
libraries to load had failed. Also, some of the libraries I linked in  
were not actually needed, and one of them would never have gotten  
loaded. by removing some unneeded libraries, and digging into the lazy  
loader and forcing it to load what I needed (which on Windows is quite  
a bit more than on Mac for some reason I still don't understand), I  
got it to work. I'll tidy up all my source and publish my work for  
other Panda3D users, and post a link here when its ready. Thanks for  
your help resolving my compile errors and warnings, as well as your  
help resolving this final loading/initialization issue. May I credit  
you in my article (probably destined for the Panda3D site's blog) on  
using Cython with Panda3D?

Thanks again,
-Craig

>
>>
>> That is significantly different from the error I get on Windows, so I
>> assumed it's a different issue.
>>
>
> You are in a different OS, so a different error should be expected
> :-). The dynamic linking semantics in OS X (and POSIX systems in
> general) are rather different...
>
> Please, go to you Mac and figure out where the TypedObject symbol  
> comes from.
>
>
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169


Gmane