With Panda 1.8.1, I was linking my C++ modules with these libraries:
-lpython2.7 -lpanda -lpandaexpress -lp3dtool -lp3dtoolconfig
When I try to build the same module with current master, I get linking errors of the type
/tmp/ccJAMaer.o: In function `Dtool_RandomBase_get_class_type_18(_object*)':
misc_c-igate.cpp:(.text+0x6f7): undefined reference to `Dtool_TypeHandle'
/tmp/ccJAMaer.o: In function `Dtool_PyModuleClassInit_NumRandom(_object*)':
misc_c-igate.cpp:(.text+0xb63): undefined reference to `Dtool_TypedObject'
misc_c-igate.cpp:(.text+0x23bd): undefined reference to `Dtool_LPoint3d'
misc_c-igate.cpp:(.text+0x241e): undefined reference to `Dtool_LVector3d'
misc_c-igate.cpp:(.text+0x2479): undefined reference to `Dtool_LVector3d'
misc_c-igate.cpp:(.text+0x24d5): undefined reference to `Dtool_LPoint3d'
I tried linking other Panda libraries, but that didn’t work. Eventually I could remove these errors by adding directly …/panda3d/core.so to compile line on Linux, and on Windows …panda3d/core.lib (which I had to copy over from Panda build directory to Panda installation directory, since only core.pyd is installed). What is the proper way to fix this?
We moved the Python bindings to core.so/core.pyd. If you don’t use the Python bindings, you shouldn’t need this for building C++ applications. But it is necessary when you have custom bindings of functions that depend on types part of the panda3d.core bindings.
We probably need to put core.lib in built/lib so that it is picked up and shipped as part of the installation for people who have custom bindings.
I expose my custom C++ functions/classes to Python (using interrogate), and these take some Panda3D types as arguments (like LVector3f). I guess this means what you said about custom bindings depending on panda3d.core bindings? If so, wouldn’t that be one rather usual use-case? Because the fact that bindings were moved to a somewhat-internal library (core.so/core.lib) implies it wasn’t…
I suppose it is a fairly normal use case. In this case, you do indeed need to link with core.lib to get the right bindings imported.
Some weeks ago, I checked in some changes to the master branch that remove the link-time dependency from Interrogate-generated stuff on core.lib. Instead, you need to add “-import panda3d.core” to have the dependencies loaded dynamically, when the module is loaded.
You do need to link to libp3interrogatedb.lib now, though, but that’s a normal library that’s in built/lib like all the others.