First, What does EXPCL_PANDA_PGRAPH Macro do?
Second, declaring private static members results confusing to me, specially when are divided between header-source files, I solve this problem declaring again, into source file, the variable TypeHandle _type_handle and didn’t show me any errors, but, at runtime, the node type is ‘none’ (Memory allocation mistake?), the other way is creating whole function on .h file, unfortunately this didn’t work: Linker show me unsatisfied reference to that member (_type_handle) which is in the same file (:?). About that:
How does Panda3D compile using private static variable members?
I would hate using Tags instead using my own node types .
Thanks for reading , any spec, please let me know.
Need to call init_type(); to rename class-type, so, in constructor:
// FIXME: Investigate why other Panda classes _
// doesn't need to init_type _
// themselves and apply to this class.
if (_type_handle.get_name(this).compare ("none") == 0){
init_type();
}
It’s just a patch, another day I’ll correct that FIXME. Sorry for SPAM
Panda does call init_type for every class, in an init_module function in the config_module.cxx files. But you don’t have to worry about that because they are automatically called at static init time.
You should probably do something similar, create a method that calls init_type() on all your classes and call that at static init time, using the ConfigureFn macro.
Check out the config_x.cxx files in the Panda source.
To answer your other question, EXPCL_PANDA_PGRAPH is used to control the __declspec(dllexport) or __declspec(dllimport) syntax that Windows obnoxiously requires in order to write code for DLL’s.
Since Windows requires the code to be compiled with __declspec(dllexport) while it is compiling for the DLL itself, and then __declspec(dllimport) while any code is referencing the DLL code with #include, we define this macro to change its meaning according to whether we are actually compiling libpanda.dll or some other code. You can see this happen in pandasymbols.h.
If you are adding your code directly to libpanda.dll, you should use EXPCL_PANDA_PGRAPH and ensure BUILDING_PANDA is defined when you compile your code. If you are adding your code to some other dll or to your own exe, you should define a different symbol; we suggest EXPCL_PANDASKEL, for instance, if you follow the example code shown in panda/src/skel (which I recommend following).