Browse Source

*** empty log message ***

David Rose 25 years ago
parent
commit
39264cbbbc
65 changed files with 676 additions and 151 deletions
  1. 22 4
      dtool/pptempl/Global.msvc.pp
  2. 35 35
      dtool/pptempl/Global.pp
  3. 12 4
      dtool/pptempl/Template.msvc.pp
  4. 1 1
      dtool/src/dtoolbase/dtoolbase_cc.h
  5. 1 1
      dtool/src/dtoolbase/dtoolsymbols.h
  6. 2 1
      panda/metalibs/panda/Sources.pp
  7. 22 4
      panda/metalibs/panda/panda.cxx
  8. 14 0
      panda/metalibs/panda/panda.h
  9. 18 4
      panda/metalibs/pandadx/pandadx.cxx
  10. 13 0
      panda/metalibs/pandadx/pandadx.h
  11. 2 1
      panda/metalibs/pandaegg/Sources.pp
  12. 20 4
      panda/metalibs/pandaegg/pandaegg.cxx
  13. 14 0
      panda/metalibs/pandaegg/pandaegg.h
  14. 4 1
      panda/metalibs/pandagl/Sources.pp
  15. 24 4
      panda/metalibs/pandagl/pandagl.cxx
  16. 14 0
      panda/metalibs/pandagl/pandagl.h
  17. 18 0
      panda/src/builder/config_builder.cxx
  18. 2 0
      panda/src/builder/config_builder.h
  19. 1 1
      panda/src/cull/cullTraverser.cxx
  20. 2 2
      panda/src/device/Sources.pp
  21. 19 0
      panda/src/device/config_device.cxx
  22. 2 0
      panda/src/device/config_device.h
  23. 21 6
      panda/src/display/graphicsPipe.cxx
  24. 3 3
      panda/src/display/graphicsPipe.h
  25. 19 3
      panda/src/display/graphicsStateGuardian.cxx
  26. 3 1
      panda/src/display/graphicsStateGuardian.h
  27. 20 4
      panda/src/display/graphicsWindow.cxx
  28. 4 2
      panda/src/display/graphicsWindow.h
  29. 19 4
      panda/src/dxgsg/config_dxgsg.cxx
  30. 1 0
      panda/src/dxgsg/config_dxgsg.h
  31. 25 6
      panda/src/egg/config_egg.cxx
  32. 2 0
      panda/src/egg/config_egg.h
  33. 19 0
      panda/src/egg2sg/config_egg2sg.cxx
  34. 1 1
      panda/src/egg2sg/config_egg2sg.h
  35. 1 0
      panda/src/express/Sources.pp
  36. 3 3
      panda/src/framework/framework.cxx
  37. 20 2
      panda/src/glgsg/config_glgsg.cxx
  38. 2 0
      panda/src/glgsg/config_glgsg.h
  39. 2 2
      panda/src/glutdisplay/config_glutdisplay.cxx
  40. 2 2
      panda/src/glxdisplay/config_glxdisplay.cxx
  41. 42 20
      panda/src/graph/config_graph.cxx
  42. 2 0
      panda/src/graph/config_graph.h
  43. 35 6
      panda/src/graph/nodeRelation.cxx
  44. 3 4
      panda/src/graph/nodeRelation.h
  45. 1 1
      panda/src/graph/wrt.I
  46. 1 1
      panda/src/pandabase/pandasymbols.h
  47. 19 0
      panda/src/pnmimage/config_pnmimage.cxx
  48. 2 0
      panda/src/pnmimage/config_pnmimage.h
  49. 3 0
      panda/src/pnmimagetypes/Sources.pp
  50. 20 0
      panda/src/pnmimagetypes/config_pnmimagetypes.cxx
  51. 2 0
      panda/src/pnmimagetypes/config_pnmimagetypes.h
  52. 2 2
      panda/src/ribdisplay/config_ribdisplay.cxx
  53. 1 1
      panda/src/ribgsg/config_ribgsg.cxx
  54. 1 1
      panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx
  55. 2 1
      panda/src/sgraph/Sources.pp
  56. 22 0
      panda/src/sgraph/config_sgraph.cxx
  57. 2 0
      panda/src/sgraph/config_sgraph.h
  58. 11 1
      panda/src/testbed/Sources.pp
  59. 30 1
      panda/src/testbed/demo.cxx
  60. 1 1
      panda/src/wdxdisplay/Sources.pp
  61. 21 2
      panda/src/wdxdisplay/config_wdxdisplay.cxx
  62. 1 0
      panda/src/wdxdisplay/config_wdxdisplay.h
  63. 1 1
      panda/src/wgldisplay/Sources.pp
  64. 21 2
      panda/src/wgldisplay/config_wgldisplay.cxx
  65. 1 0
      panda/src/wgldisplay/config_wgldisplay.h

+ 22 - 4
dtool/pptempl/Global.msvc.pp

@@ -64,12 +64,23 @@
 #endif
 #endif
 #defer CFLAGS_SHARED
 #defer CFLAGS_SHARED
 
 
+// Define LINK_ALL_STATIC to generate static libs instead of DLL's.
+#if $[LINK_ALL_STATIC]
+  #define dlink_all_static LINK_ALL_STATIC
+  #define build_dlls
+  #define dlllib lib
+#else
+  #define dlink_all_static
+  #define build_dlls yes
+  #define dlllib dll
+#endif
+
 #defer OPTFLAGS /O2 /Ob1 /Ogity /G6
 #defer OPTFLAGS /O2 /Ob1 /Ogity /G6
 
 
-#defer CDEFINES_OPT1 _DEBUG
-#defer CDEFINES_OPT2 _DEBUG
-#defer CDEFINES_OPT3
-#defer CDEFINES_OPT4 NDEBUG
+#defer CDEFINES_OPT1 _DEBUG $[dlink_all_static]
+#defer CDEFINES_OPT2 _DEBUG $[dlink_all_static]
+#defer CDEFINES_OPT3 $[dlink_all_static]
+#defer CDEFINES_OPT4 NDEBUG $[dlink_all_static]
 
 
 #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] /MDd /Gi- /GZ /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
 #defer CFLAGS_OPT1 $[CDEFINES_OPT1:%=/D%] /MDd /Gi- /GZ /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
 #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] /MDd /Gi- /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
 #defer CFLAGS_OPT2 $[CDEFINES_OPT2:%=/D%] /MDd /Gi- /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]"
@@ -108,3 +119,10 @@
 
 
 #defer LINK_BIN_C link /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
 #defer LINK_BIN_C link /nologo $[LDFLAGS_OPT$[OPTIMIZE]] $[sources] $[decygwin %,/LIBPATH:"%",$[lpath]] $[patsubst %.lib,%.lib,%,lib%.lib,$[libs]] /OUT:"$[osfilename $[target]]"
 #defer LINK_BIN_C++ $[LINK_BIN_C]
 #defer LINK_BIN_C++ $[LINK_BIN_C]
+
+#if $[LINK_ALL_STATIC]
+  #defer SHARED_LIB_C $[STATIC_LIB_C]
+  #defer SHARED_LIB_C++ $[STATIC_LIB_C++]
+  #defer ODIR_SHARED $[ODIR_STATIC]
+#endif
+

+ 35 - 35
dtool/pptempl/Global.pp

@@ -461,55 +461,55 @@
 #defun get_lpath
 #defun get_lpath
   #define alt_lpath $[nspr_lpath] $[python_lpath]
   #define alt_lpath $[nspr_lpath] $[python_lpath]
   
   
-  #if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
+  #if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[crypto_lpath]
     #set alt_lpath $[alt_lpath] $[crypto_lpath]
   #endif
   #endif
-  #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
+  #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[zlib_lpath]
     #set alt_lpath $[alt_lpath] $[zlib_lpath]
   #endif
   #endif
-  #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],]
+  #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[gl_lpath]
     #set alt_lpath $[alt_lpath] $[gl_lpath]
   #endif
   #endif
-  #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],]
+  #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[glx_lpath]
     #set alt_lpath $[alt_lpath] $[glx_lpath]
   #endif
   #endif
-  #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],]
+  #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[glut_lpath]
     #set alt_lpath $[alt_lpath] $[glut_lpath]
   #endif
   #endif
-  #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],]
+  #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[dx_lpath]
     #set alt_lpath $[alt_lpath] $[dx_lpath]
   #endif
   #endif
-  #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],]
+  #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[soxst_lpath]
     #set alt_lpath $[alt_lpath] $[soxst_lpath]
   #endif
   #endif
-  #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],]
+  #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[ipc_lpath]
     #set alt_lpath $[alt_lpath] $[ipc_lpath]
   #endif
   #endif
-  #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],]
+  #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[net_lpath]
     #set alt_lpath $[alt_lpath] $[net_lpath]
   #endif
   #endif
-  #if $[ne $[USE_JPEG] $[components $[USE_JPEG],$[active_component_libs]],]
+  #if $[ne $[USE_JPEG] $[components $[USE_JPEG],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[jpeg_lpath]
     #set alt_lpath $[alt_lpath] $[jpeg_lpath]
   #endif
   #endif
-  #if $[ne $[USE_TIFF] $[components $[USE_TIFF],$[active_component_libs]],]
+  #if $[ne $[USE_TIFF] $[components $[USE_TIFF],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[tiff_lpath]
     #set alt_lpath $[alt_lpath] $[tiff_lpath]
   #endif
   #endif
-  #if $[ne $[USE_FFTW] $[components $[USE_FFTW],$[active_component_libs]],]
+  #if $[ne $[USE_FFTW] $[components $[USE_FFTW],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[fftw_lpath]
     #set alt_lpath $[alt_lpath] $[fftw_lpath]
   #endif
   #endif
-  #if $[ne $[USE_VRPN] $[components $[USE_VRPN],$[active_component_libs]],]
+  #if $[ne $[USE_VRPN] $[components $[USE_VRPN],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[vrpn_lpath]
     #set alt_lpath $[alt_lpath] $[vrpn_lpath]
   #endif
   #endif
-  #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],]
+  #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[audio_lpath]
     #set alt_lpath $[alt_lpath] $[audio_lpath]
   #endif
   #endif
-  #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],]
+  #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[mikmod_lpath]
     #set alt_lpath $[alt_lpath] $[mikmod_lpath]
   #endif
   #endif
-  #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],]
+  #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[gtkmm_lpath]
     #set alt_lpath $[alt_lpath] $[gtkmm_lpath]
   #endif 
   #endif 
-  #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],]
+  #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs] $[transitive_link]],]
     #set alt_lpath $[alt_lpath] $[maya_lpath]
     #set alt_lpath $[alt_lpath] $[maya_lpath]
   #endif
   #endif
 
 
@@ -524,59 +524,59 @@
 #defun get_libs
 #defun get_libs
   #define alt_libs $[nspr_libs] $[python_libs]
   #define alt_libs $[nspr_libs] $[python_libs]
   
   
-  #if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs]],]
+  #if $[ne $[USE_CRYPTO] $[components $[USE_CRYPTO],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[crypto_libs]
     #set alt_libs $[alt_libs] $[crypto_libs]
   #endif
   #endif
-  #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs]],]
+  #if $[ne $[USE_ZLIB] $[components $[USE_ZLIB],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[zlib_libs]
     #set alt_libs $[alt_libs] $[zlib_libs]
   #endif
   #endif
-  #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs]],]
+  #if $[ne $[USE_GL] $[components $[USE_GL],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[gl_libs]
     #set alt_libs $[alt_libs] $[gl_libs]
   #endif
   #endif
-  #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs]],]
+  #if $[ne $[USE_GLX] $[components $[USE_GLX],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[glx_libs]
     #set alt_libs $[alt_libs] $[glx_libs]
   #endif
   #endif
-  #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs]],]
+  #if $[ne $[USE_GLUT] $[components $[USE_GLUT],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[glut_libs]
     #set alt_libs $[alt_libs] $[glut_libs]
   #endif
   #endif
-  #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs]],]
+  #if $[ne $[USE_DX] $[components $[USE_DX],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[dx_libs]
     #set alt_libs $[alt_libs] $[dx_libs]
   #endif
   #endif
-  #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs]],]
+  #if $[ne $[USE_SOXST] $[components $[USE_SOXST],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[soxst_libs]
     #set alt_libs $[alt_libs] $[soxst_libs]
   #endif
   #endif
-  #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs]],]
+  #if $[ne $[USE_IPC] $[components $[USE_IPC],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[ipc_libs]
     #set alt_libs $[alt_libs] $[ipc_libs]
   #endif
   #endif
-  #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs]],]
+  #if $[ne $[USE_NET] $[components $[USE_NET],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[net_libs]
     #set alt_libs $[alt_libs] $[net_libs]
   #endif
   #endif
-  #if $[ne $[USE_JPEG] $[components $[USE_JPEG],$[active_component_libs]],]
+  #if $[ne $[USE_JPEG] $[components $[USE_JPEG],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[jpeg_libs]
     #set alt_libs $[alt_libs] $[jpeg_libs]
   #endif
   #endif
-  #if $[ne $[USE_TIFF] $[components $[USE_TIFF],$[active_component_libs]],]
+  #if $[ne $[USE_TIFF] $[components $[USE_TIFF],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[tiff_libs]
     #set alt_libs $[alt_libs] $[tiff_libs]
   #endif
   #endif
-  #if $[ne $[USE_FFTW] $[components $[USE_FFTW],$[active_component_libs]],]
+  #if $[ne $[USE_FFTW] $[components $[USE_FFTW],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[fftw_libs]
     #set alt_libs $[alt_libs] $[fftw_libs]
   #endif
   #endif
-  #if $[ne $[USE_VRPN] $[components $[USE_VRPN],$[active_component_libs]],]
+  #if $[ne $[USE_VRPN] $[components $[USE_VRPN],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[vrpn_libs]
     #set alt_libs $[alt_libs] $[vrpn_libs]
   #endif
   #endif
-  #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs]],]
+  #if $[ne $[USE_AUDIO] $[components $[USE_AUDIO],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[audio_libs]
     #set alt_libs $[alt_libs] $[audio_libs]
   #endif
   #endif
-  #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs]],]
+  #if $[ne $[USE_MIKMOD] $[components $[USE_MIKMOD],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[mikmod_libs]
     #set alt_libs $[alt_libs] $[mikmod_libs]
   #endif
   #endif
-  #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs]],]
+  #if $[ne $[USE_GTKMM] $[components $[USE_GTKMM],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[gtkmm_libs]
     #set alt_libs $[alt_libs] $[gtkmm_libs]
   #endif 
   #endif 
-  #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs]],]
+  #if $[ne $[USE_MAYA] $[components $[USE_MAYA],$[active_component_libs] $[transitive_link]],]
     #set alt_libs $[alt_libs] $[maya_libs]
     #set alt_libs $[alt_libs] $[maya_libs]
   #endif
   #endif
   #if $[UNIX_PLATFORM]
   #if $[UNIX_PLATFORM]
-    #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs]]
+    #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_component_libs] $[transitive_link]]
   #endif
   #endif
 
 
   $[alt_libs]
   $[alt_libs]

+ 12 - 4
dtool/pptempl/Template.msvc.pp

@@ -74,7 +74,7 @@
 // $[bin_targets] the list of binaries.  $[test_bin_targets] is the
 // $[bin_targets] the list of binaries.  $[test_bin_targets] is the
 // list of binaries that are to be built only when specifically asked
 // list of binaries that are to be built only when specifically asked
 // for.
 // for.
-#define lib_targets $[patsubst %,$[so_dir]\lib%$[dllext].dll,$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]]
+#define lib_targets $[patsubst %,$[so_dir]\lib%$[dllext].$[dlllib],$[active_target(metalib_target noinst_lib_target)] $[real_lib_targets]]
 #define static_lib_targets $[active_target(static_lib_target ss_lib_target):%=$[st_dir]\lib%$[dllext].lib]
 #define static_lib_targets $[active_target(static_lib_target ss_lib_target):%=$[st_dir]\lib%$[dllext].lib]
 #define bin_targets \
 #define bin_targets \
     $[active_target(bin_target noinst_bin_target):%=$[st_dir]\%.exe] \
     $[active_target(bin_target noinst_bin_target):%=$[st_dir]\%.exe] \
@@ -322,7 +322,7 @@ $[osfilename $[directory]] :
    $[components $[unique $[patsubst %.cxx %.c %.yxx %.lxx,$[RELDIR]\$[so_dir]\%.obj,%,,$[get_sources] $[get_igateoutput]]],$[active_component_libs]]
    $[components $[unique $[patsubst %.cxx %.c %.yxx %.lxx,$[RELDIR]\$[so_dir]\%.obj,%,,$[get_sources] $[get_igateoutput]]],$[active_component_libs]]
   #define varname $[subst -,_,lib$[TARGET]_so]
   #define varname $[subst -,_,lib$[TARGET]_so]
 $[varname] = $[osfilename $[sources]]
 $[varname] = $[osfilename $[sources]]
-  #define target $[so_dir]\lib$[TARGET]$[dllext].dll
+  #define target $[so_dir]\lib$[TARGET]$[dllext].$[dlllib]
   #define sources $($[varname])
   #define sources $($[varname])
   #define flags   $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]  
   #define flags   $[get_cflags] $[C++FLAGS] $[CFLAGS_OPT$[OPTIMIZE]] $[CFLAGS_SHARED] $[building_var:%=/D%]  
 $[target] : $[sources] "$[dtool_ver_dir]\version.rc"
 $[target] : $[sources] "$[dtool_ver_dir]\version.rc"
@@ -336,7 +336,9 @@ $[target] : $[sources] "$[dtool_ver_dir]\version.rc"
 	$[SHARED_LIB_C]
 	$[SHARED_LIB_C]
   #endif
   #endif
 
 
+#if $[build_dlls]
 $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
 $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
+#endif
 
 
 #endif
 #endif
 
 
@@ -344,7 +346,7 @@ $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
 // everything that goes along with it.
 // everything that goes along with it.
 #define installed_files \
 #define installed_files \
     $[if $[build_it], \
     $[if $[build_it], \
-      $[install_lib_dir]\lib$[TARGET]$[dllext].dll \
+      $[if $[build_dlls],$[install_lib_dir]\lib$[TARGET]$[dllext].dll] \
       $[install_lib_dir]\lib$[TARGET]$[dllext].lib \
       $[install_lib_dir]\lib$[TARGET]$[dllext].lib \
     ] \
     ] \
     $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
     $[INSTALL_SCRIPTS:%=$[install_bin_dir]\%] \
@@ -360,10 +362,12 @@ uninstall-lib$[TARGET] :
 	-del /f $[file]
 	-del /f $[file]
 #end file
 #end file
 
 
+#if $[build_dlls]
 $[install_lib_dir]\lib$[TARGET]$[dllext].dll : $[so_dir]\lib$[TARGET]$[dllext].dll
 $[install_lib_dir]\lib$[TARGET]$[dllext].dll : $[so_dir]\lib$[TARGET]$[dllext].dll
 #define local lib$[TARGET]$[dllext].dll
 #define local lib$[TARGET]$[dllext].dll
 #define dest $[install_lib_dir]
 #define dest $[install_lib_dir]
 	copy $[so_dir]\$[local] $[dest]
 	copy $[so_dir]\$[local] $[dest]
+#endif
 
 
 $[install_lib_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].lib
 $[install_lib_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].lib
 #define local lib$[TARGET]$[dllext].lib
 #define local lib$[TARGET]$[dllext].lib
@@ -439,7 +443,7 @@ $[target] : $[source]
 #forscopes noinst_lib_target
 #forscopes noinst_lib_target
 #define varname $[subst -,_,lib$[TARGET]_so]
 #define varname $[subst -,_,lib$[TARGET]_so]
 $[varname] = $[osfilename $[unique $[patsubst %.cxx %.c %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources]]]]
 $[varname] = $[osfilename $[unique $[patsubst %.cxx %.c %.yxx %.lxx,$[so_dir]\%.obj,%,,$[get_sources]]]]
-#define target $[so_dir]\lib$[TARGET]$[dllext].dll
+#define target $[so_dir]\lib$[TARGET]$[dllext].$[dlllib]
 #define sources $($[varname])
 #define sources $($[varname])
 $[target] : $[sources]
 $[target] : $[sources]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
 #if $[filter %.cxx %.yxx %.lxx,$[get_sources]]
@@ -448,7 +452,9 @@ $[target] : $[sources]
 	$[SHARED_LIB_C]
 	$[SHARED_LIB_C]
 #endif
 #endif
 
 
+#if $[build_dlls]
 $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
 $[so_dir]\lib$[TARGET]$[dllext].lib : $[so_dir]\lib$[TARGET]$[dllext].dll
+#endif
 
 
 #end noinst_lib_target
 #end noinst_lib_target
 
 
@@ -541,6 +547,7 @@ $[varname] = $[osfilename $[unique $[patsubst %.cxx %.c %.yxx %.lxx,$[st_dir]\%.
 #define target $[st_dir]\$[TARGET].exe
 #define target $[st_dir]\$[TARGET].exe
 #define sources $($[varname])
 #define sources $($[varname])
 #define ld $[get_ld]
 #define ld $[get_ld]
+#define transitive_link $[complete_local_libs]
 $[target] : $[sources]
 $[target] : $[sources]
 #if $[ld]
 #if $[ld]
   // If there's a custom linker defined for the target, we have to use it.
   // If there's a custom linker defined for the target, we have to use it.
@@ -553,6 +560,7 @@ $[target] : $[sources]
 	$[LINK_BIN_C]
 	$[LINK_BIN_C]
   #endif
   #endif
 #endif
 #endif
+#define transitive_link
 
 
 #define installed_files \
 #define installed_files \
     $[install_bin_dir]\$[TARGET].exe \
     $[install_bin_dir]\$[TARGET].exe \

+ 1 - 1
dtool/src/dtoolbase/dtoolbase_cc.h

@@ -54,7 +54,7 @@ using namespace std;
 #define INLINE inline
 #define INLINE inline
 #define TYPENAME typename
 #define TYPENAME typename
 
 
-#ifdef WIN32_VC
+#if defined(WIN32_VC) && !defined(LINK_ALL_STATIC)
 // This macro must be used to export an instantiated template class
 // This macro must be used to export an instantiated template class
 // from a DLL.  If the template class name itself contains commas, it
 // from a DLL.  If the template class name itself contains commas, it
 // may be necessary to first define a macro for the class name, to
 // may be necessary to first define a macro for the class name, to

+ 1 - 1
dtool/src/dtoolbase/dtoolsymbols.h

@@ -36,7 +36,7 @@
 
 
 #define EXPCL_EMPTY
 #define EXPCL_EMPTY
 
 
-#if defined(WIN32_VC) && !defined(CPPPARSER)
+#if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
 
 
 #ifdef BUILDING_DTOOL
 #ifdef BUILDING_DTOOL
   #define EXPCL_DTOOL __declspec(dllexport)
   #define EXPCL_DTOOL __declspec(dllexport)

+ 2 - 1
panda/metalibs/panda/Sources.pp

@@ -24,5 +24,6 @@
 #begin metalib_target
 #begin metalib_target
   #define TARGET panda
   #define TARGET panda
 
 
-  #define SOURCES panda.cxx
+  #define SOURCES panda.cxx panda.h
+  #define INSTALL_HEADERS panda.h
 #end metalib_target
 #end metalib_target

+ 22 - 4
panda/metalibs/panda/panda.cxx

@@ -3,7 +3,25 @@
 // 
 // 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpanda.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpanda.
+#include "panda.h"
+
+#include <config_device.h>
+#include <config_graph.h>
+#include <config_sgraph.h>
+#include <config_pnmimagetypes.h>
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpanda
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpanda() {
+  init_libdevice();
+  init_libgraph();
+  init_libsgraph();
+  init_libpnmimagetypes();
+}

+ 14 - 0
panda/metalibs/panda/panda.h

@@ -0,0 +1,14 @@
+// Filename: panda.h
+// Created by:  drose (2Jan01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDA_H
+#define PANDA_H
+
+#include <pandabase.h>
+
+EXPCL_PANDA void init_libpanda();
+
+#endif
+

+ 18 - 4
panda/metalibs/pandadx/pandadx.cxx

@@ -3,7 +3,21 @@
 // 
 // 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpandadx.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpandadx.
+#include "pandadx.h"
+
+#include <config_dxgsg.h>
+#include <config_wdxdisplay.h>
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpandadx
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpandadx() {
+  init_libdxgsg();
+  init_libwdxdisplay();
+}

+ 13 - 0
panda/metalibs/pandadx/pandadx.h

@@ -0,0 +1,13 @@
+// Filename: pandadx.h
+// Created by:  drose (2Jan01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDADX_H
+#define PANDADX_H
+
+#include <pandabase.h>
+
+EXPCL_PANDADX void init_libpandadx();
+
+#endif

+ 2 - 1
panda/metalibs/pandaegg/Sources.pp

@@ -16,5 +16,6 @@
 #begin metalib_target
 #begin metalib_target
   #define TARGET pandaegg
   #define TARGET pandaegg
 
 
-  #define SOURCES pandaegg.cxx
+  #define SOURCES pandaegg.cxx pandaegg.h
+  #define INSTALL_HEADERS pandaegg.h
 #end metalib_target
 #end metalib_target

+ 20 - 4
panda/metalibs/pandaegg/pandaegg.cxx

@@ -3,7 +3,23 @@
 // 
 // 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpandaegg.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpandaegg.
+#include "pandaegg.h"
+
+#include <config_egg.h>
+#include <config_builder.h>
+#include <config_egg2sg.h>
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpandaegg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpandaegg() {
+  init_libegg();
+  init_libbuilder();
+  init_libegg2sg();
+}

+ 14 - 0
panda/metalibs/pandaegg/pandaegg.h

@@ -0,0 +1,14 @@
+// Filename: pandaegg.h
+// Created by:  drose (2Jan01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDAEGG_H
+#define PANDAEGG_H
+
+#include <pandabase.h>
+
+EXPCL_PANDAEGG void init_libpandaegg();
+
+#endif
+

+ 4 - 1
panda/metalibs/pandagl/Sources.pp

@@ -19,5 +19,8 @@
 #begin metalib_target
 #begin metalib_target
   #define TARGET pandagl
   #define TARGET pandagl
 
 
-  #define SOURCES pandagl.cxx
+  #define SOURCES pandagl.cxx pandagl.h
+
+  #define INSTALL_HEADERS pandagl.h
+
 #end metalib_target
 #end metalib_target

+ 24 - 4
panda/metalibs/pandagl/pandagl.cxx

@@ -3,7 +3,27 @@
 // 
 // 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 
 
-// This is a dummy file whose sole purpose is to give the compiler
-// something to compile when making libpandagl.so in NO_DEFER mode,
-// which generates an empty library that itself links with all the
-// other shared libraries that make up libpandagl.
+#include "pandagl.h"
+
+#include <config_glgsg.h>
+
+#ifdef HAVE_WGL
+#include <config_wgldisplay.h>
+#endif
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpandagl
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpandagl() {
+  init_libglgsg();
+
+#ifdef HAVE_WGL
+  init_libwgldisplay();
+#endif
+}

+ 14 - 0
panda/metalibs/pandagl/pandagl.h

@@ -0,0 +1,14 @@
+// Filename: pandagl.h
+// Created by:  drose (2Jan01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PANDAGL_H
+#define PANDAGL_H
+
+#include <pandabase.h>
+
+EXPCL_PANDAGL void init_libpandagl();
+
+#endif
+

+ 18 - 0
panda/src/builder/config_builder.cxx

@@ -11,4 +11,22 @@ Configure(config_builder);
 NotifyCategoryDef(builder, "");
 NotifyCategoryDef(builder, "");
 
 
 ConfigureFn(config_builder) {
 ConfigureFn(config_builder) {
+  init_libbuilder();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libbuilder
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libbuilder() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
 }
 }

+ 2 - 0
panda/src/builder/config_builder.h

@@ -11,4 +11,6 @@
 
 
 NotifyCategoryDecl(builder, EXPCL_PANDAEGG, EXPTP_PANDAEGG);
 NotifyCategoryDecl(builder, EXPCL_PANDAEGG, EXPTP_PANDAEGG);
 
 
+extern EXPCL_PANDAEGG void init_libbuilder();
+
 #endif
 #endif

+ 1 - 1
panda/src/cull/cullTraverser.cxx

@@ -189,7 +189,7 @@ traverse(Node *root,
       _as_of = UpdateSeq::initial();
       _as_of = UpdateSeq::initial();
     }
     }
   }
   }
-  _now = last_graph_update[_graph_type];
+  _now = last_graph_update(_graph_type);
   _nested_count++;
   _nested_count++;
 
 
   if (is_initial) {
   if (is_initial) {

+ 2 - 2
panda/src/device/Sources.pp

@@ -15,8 +15,8 @@
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
     adinputNode.h analogData.I analogData.h buttonData.I buttonData.h \
     adinputNode.h analogData.I analogData.h buttonData.I buttonData.h \
-    clientBase.h dialData.I dialData.h mouse.h trackerData.I \
-    trackerData.h trackerNode.h
+    clientBase.h config_device.h dialData.I dialData.h mouse.h \
+    trackerData.I trackerData.h trackerNode.h
 
 
   #define IGATESCAN all
   #define IGATESCAN all
 
 

+ 19 - 0
panda/src/device/config_device.cxx

@@ -17,6 +17,25 @@ NotifyCategoryDef(device, "");
 const bool asynchronous_clients = config_device.GetBool("asynchronous-clients", false);
 const bool asynchronous_clients = config_device.GetBool("asynchronous-clients", false);
 
 
 ConfigureFn(config_device) {
 ConfigureFn(config_device) {
+  init_libdevice();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libdevice
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libdevice() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   MouseAndKeyboard::init_type();
   MouseAndKeyboard::init_type();
   TrackerNode::init_type();
   TrackerNode::init_type();
   ADInputNode::init_type();
   ADInputNode::init_type();

+ 2 - 0
panda/src/device/config_device.h

@@ -13,4 +13,6 @@ NotifyCategoryDecl(device, EXPCL_PANDA, EXPTP_PANDA);
 
 
 extern const bool asynchronous_clients;
 extern const bool asynchronous_clients;
 
 
+extern EXPCL_PANDA void init_libdevice();
+
 #endif
 #endif

+ 21 - 6
panda/src/display/graphicsPipe.cxx

@@ -19,10 +19,9 @@
 TypeHandle GraphicsPipe::_type_handle;
 TypeHandle GraphicsPipe::_type_handle;
 TypeHandle GraphicsPipe::PipeSpec::_type_handle;
 TypeHandle GraphicsPipe::PipeSpec::_type_handle;
 
 
-GraphicsPipe::PipeFactory GraphicsPipe::_factory;
-
 // These static members are pointers rather than concrete objects so
 // These static members are pointers rather than concrete objects so
 // we can guarantee order of creation at static init time.
 // we can guarantee order of creation at static init time.
+GraphicsPipe::PipeFactory *GraphicsPipe::_factory = NULL;
 GraphicsPipe::Pipes *GraphicsPipe::_all_pipes = NULL;
 GraphicsPipe::Pipes *GraphicsPipe::_all_pipes = NULL;
 
 
 GraphicsPipe::PipeSpec::~PipeSpec(void) {}
 GraphicsPipe::PipeSpec::~PipeSpec(void) {}
@@ -134,7 +133,7 @@ make_window() {
   FactoryParams params;
   FactoryParams params;
   params.add_param(new GraphicsWindow::WindowPipe(this));
   params.add_param(new GraphicsWindow::WindowPipe(this));
 
 
-  GraphicsWindow *win = GraphicsWindow::_factory.
+  GraphicsWindow *win = GraphicsWindow::get_factory().
     make_instance(get_window_type(), params);
     make_instance(get_window_type(), params);
   nassertr(win != (GraphicsWindow *)NULL, NULL);
   nassertr(win != (GraphicsWindow *)NULL, NULL);
 
 
@@ -157,7 +156,7 @@ make_window(const GraphicsWindow::Properties &props) {
   params.add_param(new GraphicsWindow::WindowPipe(this));
   params.add_param(new GraphicsWindow::WindowPipe(this));
   params.add_param(new GraphicsWindow::WindowProps(props));
   params.add_param(new GraphicsWindow::WindowProps(props));
 
 
-  GraphicsWindow *win = GraphicsWindow::_factory.
+  GraphicsWindow *win = GraphicsWindow::get_factory().
     make_instance(get_window_type(), params);
     make_instance(get_window_type(), params);
   nassertr(win != (GraphicsWindow *)NULL, NULL);
   nassertr(win != (GraphicsWindow *)NULL, NULL);
 
 
@@ -294,7 +293,8 @@ add_window(GraphicsWindow *win) {
 }
 }
 
 
 void GraphicsPipe::read_priorities(void) {
 void GraphicsPipe::read_priorities(void) {
-  if (_factory.get_num_preferred() == 0) {
+  PipeFactory &factory = get_factory();
+  if (factory.get_num_preferred() == 0) {
     Config::ConfigTable::Symbol::iterator i;
     Config::ConfigTable::Symbol::iterator i;
     for (i = preferred_pipe_begin(); i != preferred_pipe_end(); ++i) {
     for (i = preferred_pipe_begin(); i != preferred_pipe_end(); ++i) {
       ConfigString type_name = (*i).Val();
       ConfigString type_name = (*i).Val();
@@ -306,12 +306,27 @@ void GraphicsPipe::read_priorities(void) {
       } else {
       } else {
 	display_cat.debug()
 	display_cat.debug()
 	  << "Specifying type " << type << " for pipe preference.\n";
 	  << "Specifying type " << type << " for pipe preference.\n";
-	_factory.add_preferred(type);
+	factory.add_preferred(type);
       }
       }
     }
     }
   }
   }
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsPipe::get_factory
+//       Access: Public, Static
+//  Description: Returns the factory object that can be used to
+//               register new kinds of GraphicsPipe objects that may
+//               be created.
+////////////////////////////////////////////////////////////////////
+GraphicsPipe::PipeFactory &GraphicsPipe::
+get_factory() {
+  if (_factory == (PipeFactory *)NULL) {
+    _factory = new PipeFactory;
+  }
+  return (*_factory);
+}
+
 void GraphicsPipe::resolve_modules(void) {
 void GraphicsPipe::resolve_modules(void) {
   Config::ConfigTable::Symbol::iterator i;
   Config::ConfigTable::Symbol::iterator i;
 
 

+ 3 - 3
panda/src/display/graphicsPipe.h

@@ -88,8 +88,7 @@ public:
     static TypeHandle _type_handle;
     static TypeHandle _type_handle;
   };
   };
 
 
-  static PipeFactory _factory;
-
+  static PipeFactory &get_factory();
   static void resolve_modules(void);
   static void resolve_modules(void);
 
 
 private:
 private:
@@ -108,7 +107,8 @@ private:
   typedef vector<GraphicsPipe *> Pipes;
   typedef vector<GraphicsPipe *> Pipes;
 
 
   Windows _windows;
   Windows _windows;
-
+ 
+  static PipeFactory *_factory;
   static Pipes *_all_pipes;
   static Pipes *_all_pipes;
   INLINE static Pipes &get_all_pipes();
   INLINE static Pipes &get_all_pipes();
 
 

+ 19 - 3
panda/src/display/graphicsStateGuardian.cxx

@@ -15,7 +15,7 @@
 TypeHandle GraphicsStateGuardian::_type_handle;
 TypeHandle GraphicsStateGuardian::_type_handle;
 TypeHandle GraphicsStateGuardian::GsgWindow::_type_handle;
 TypeHandle GraphicsStateGuardian::GsgWindow::_type_handle;
 
 
-GraphicsStateGuardian::GsgFactory GraphicsStateGuardian::_factory;
+GraphicsStateGuardian::GsgFactory *GraphicsStateGuardian::_factory = NULL;
 
 
 GraphicsStateGuardian::GsgWindow::~GsgWindow(void) {}
 GraphicsStateGuardian::GsgWindow::~GsgWindow(void) {}
 
 
@@ -414,9 +414,25 @@ unmark_prepared_texture(TextureContext *tc) {
 }
 }
 
 
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsStateGuardian::get_factory
+//       Access: Public, Static
+//  Description: Returns the factory object that can be used to
+//               register new kinds of GraphicsStateGuardian objects that may
+//               be created.
+////////////////////////////////////////////////////////////////////
+GraphicsStateGuardian::GsgFactory &GraphicsStateGuardian::
+get_factory() {
+  if (_factory == (GsgFactory *)NULL) {
+    _factory = new GsgFactory;
+  }
+  return (*_factory);
+}
+
 void GraphicsStateGuardian::read_priorities(void)
 void GraphicsStateGuardian::read_priorities(void)
 {
 {
-  if (_factory.get_num_preferred() == 0) {
+  GsgFactory &factory = get_factory();
+  if (factory.get_num_preferred() == 0) {
     Config::ConfigTable::Symbol::iterator i;
     Config::ConfigTable::Symbol::iterator i;
     for (i = preferred_gsg_begin(); i != preferred_gsg_end(); ++i) {
     for (i = preferred_gsg_begin(); i != preferred_gsg_end(); ++i) {
       ConfigString type_name = (*i).Val();
       ConfigString type_name = (*i).Val();
@@ -428,7 +444,7 @@ void GraphicsStateGuardian::read_priorities(void)
       } else {
       } else {
 	display_cat.debug()
 	display_cat.debug()
 	  << "Specifying type " << type << " for GSG preference.\n";
 	  << "Specifying type " << type << " for GSG preference.\n";
-	_factory.add_preferred(type);
+	factory.add_preferred(type);
       }
       }
     }
     }
   }
   }

+ 3 - 1
panda/src/display/graphicsStateGuardian.h

@@ -182,11 +182,13 @@ public:
     INLINE GsgWindow(void) : GsgParam() {}
     INLINE GsgWindow(void) : GsgParam() {}
   };
   };
 
 
-  static GsgFactory _factory;
+  static GsgFactory &get_factory();
 
 
 private:
 private:
   static void read_priorities(void);
   static void read_priorities(void);
 
 
+  static GsgFactory *_factory;
+
 public:
 public:
   INLINE GraphicsWindow* get_window(void) const { return _win; }
   INLINE GraphicsWindow* get_window(void) const { return _win; }
 
 

+ 20 - 4
panda/src/display/graphicsWindow.cxx

@@ -22,7 +22,7 @@ TypeHandle GraphicsWindow::_type_handle;
 TypeHandle GraphicsWindow::WindowProps::_type_handle;
 TypeHandle GraphicsWindow::WindowProps::_type_handle;
 TypeHandle GraphicsWindow::WindowPipe::_type_handle;
 TypeHandle GraphicsWindow::WindowPipe::_type_handle;
 
 
-GraphicsWindow::WindowFactory GraphicsWindow::_factory;
+GraphicsWindow::WindowFactory *GraphicsWindow::_factory = NULL;
 
 
 PStatCollector GraphicsWindow::_app_pcollector =
 PStatCollector GraphicsWindow::_app_pcollector =
   PStatCollector("App", RGBColorf(0,1,1));
   PStatCollector("App", RGBColorf(0,1,1));
@@ -497,14 +497,30 @@ make_gsg() {
   FactoryParams params;
   FactoryParams params;
   params.add_param(new GraphicsStateGuardian::GsgWindow(this));
   params.add_param(new GraphicsStateGuardian::GsgWindow(this));
   
   
-  _gsg = GraphicsStateGuardian::_factory.
+  _gsg = GraphicsStateGuardian::get_factory().
     make_instance(get_gsg_type(), params);
     make_instance(get_gsg_type(), params);
 
 
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
   nassertv(_gsg != (GraphicsStateGuardian *)NULL);
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsWindow::get_factory
+//       Access: Public, Static
+//  Description: Returns the factory object that can be used to
+//               register new kinds of GraphicsWindow objects that may
+//               be created.
+////////////////////////////////////////////////////////////////////
+GraphicsWindow::WindowFactory &GraphicsWindow::
+get_factory() {
+  if (_factory == (WindowFactory *)NULL) {
+    _factory = new WindowFactory;
+  }
+  return (*_factory);
+}
+
 void GraphicsWindow::read_priorities(void) {
 void GraphicsWindow::read_priorities(void) {
-  if (_factory.get_num_preferred() == 0) {
+  WindowFactory &factory = get_factory();
+  if (factory.get_num_preferred() == 0) {
     Config::ConfigTable::Symbol::iterator i;
     Config::ConfigTable::Symbol::iterator i;
     for (i = preferred_window_begin(); i != preferred_window_end(); ++i) {
     for (i = preferred_window_begin(); i != preferred_window_end(); ++i) {
       ConfigString type_name = (*i).Val();
       ConfigString type_name = (*i).Val();
@@ -516,7 +532,7 @@ void GraphicsWindow::read_priorities(void) {
       } else {
       } else {
 	display_cat.debug()
 	display_cat.debug()
 	  << "Specifying type " << type << " for window preference.\n";
 	  << "Specifying type " << type << " for window preference.\n";
-	_factory.add_preferred(type);
+	factory.add_preferred(type);
       }
       }
     }
     }
   }
   }

+ 4 - 2
panda/src/display/graphicsWindow.h

@@ -196,7 +196,7 @@ protected:
 private:
 private:
   typedef vector<PT(GraphicsChannel)> Channels;
   typedef vector<PT(GraphicsChannel)> Channels;
   Channels _channels;
   Channels _channels;
- 
+
 public:
 public:
 
 
   // factory stuff
   // factory stuff
@@ -237,7 +237,7 @@ public:
     INLINE WindowPipe(void) : WindowParam() {}
     INLINE WindowPipe(void) : WindowParam() {}
   };
   };
 
 
-  static WindowFactory _factory;
+  static WindowFactory &get_factory();
 
 
 private:
 private:
 
 
@@ -245,6 +245,8 @@ private:
  
  
   GraphicsWindow(const GraphicsWindow&);
   GraphicsWindow(const GraphicsWindow&);
   GraphicsWindow &operator=(const GraphicsWindow&);
   GraphicsWindow &operator=(const GraphicsWindow&);
+
+  static WindowFactory *_factory;
  
  
 public:
 public:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {

+ 19 - 4
panda/src/dxgsg/config_dxgsg.cxx

@@ -57,6 +57,24 @@ parse_decal_type(const string &type) {
 }
 }
 
 
 ConfigureFn(config_dxgsg) {
 ConfigureFn(config_dxgsg) {
+  init_libdxgsg();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libdxgsg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libdxgsg() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
 
 
   string decal_type = config_dxgsg.GetString("dx-decal-type", "");
   string decal_type = config_dxgsg.GetString("dx-decal-type", "");
   if (!decal_type.empty()) {
   if (!decal_type.empty()) {
@@ -67,10 +85,7 @@ ConfigureFn(config_dxgsg) {
   DXSavedFrameBuffer::init_type();
   DXSavedFrameBuffer::init_type();
   DXTextureContext::init_type();
   DXTextureContext::init_type();
 
 
-  GraphicsStateGuardian::_factory.register_factory
+  GraphicsStateGuardian::get_factory().register_factory
     (DXGraphicsStateGuardian::get_class_type(),
     (DXGraphicsStateGuardian::get_class_type(),
      DXGraphicsStateGuardian::make_DXGraphicsStateGuardian);
      DXGraphicsStateGuardian::make_DXGraphicsStateGuardian);
 }
 }
-
-
-

+ 1 - 0
panda/src/dxgsg/config_dxgsg.h

@@ -33,5 +33,6 @@ enum DXDecalType {
 };
 };
 extern DXDecalType dx_decal_type;
 extern DXDecalType dx_decal_type;
 
 
+extern EXPCL_PANDADX void init_libdxgsg();
 
 
 #endif
 #endif

+ 25 - 6
panda/src/egg/config_egg.cxx

@@ -44,6 +44,31 @@ Configure(config_egg);
 NotifyCategoryDef(egg, "");
 NotifyCategoryDef(egg, "");
 
 
 ConfigureFn(config_egg) {
 ConfigureFn(config_egg) {
+  init_libegg();
+}
+
+const DSearchPath &
+get_egg_path() {
+  static DSearchPath *egg_path = NULL;
+  return get_config_path("egg-path", egg_path);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libegg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libegg() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   EggRenderMode::init_type();
   EggRenderMode::init_type();
   EggAnimData::init_type();
   EggAnimData::init_type();
   EggAttributes::init_type();
   EggAttributes::init_type();
@@ -79,9 +104,3 @@ ConfigureFn(config_egg) {
   EggXfmAnimData::init_type();
   EggXfmAnimData::init_type();
   EggXfmSAnim::init_type();
   EggXfmSAnim::init_type();
 }
 }
-
-const DSearchPath &
-get_egg_path() {
-  static DSearchPath *egg_path = NULL;
-  return get_config_path("egg-path", egg_path);
-}

+ 2 - 0
panda/src/egg/config_egg.h

@@ -15,4 +15,6 @@ NotifyCategoryDecl(egg, EXPCL_PANDAEGG, EXPTP_PANDAEGG);
 
 
 const DSearchPath &get_egg_path();
 const DSearchPath &get_egg_path();
 
 
+extern EXPCL_PANDAEGG void init_libegg();
+
 #endif
 #endif

+ 19 - 0
panda/src/egg2sg/config_egg2sg.cxx

@@ -51,6 +51,25 @@ bool egg_keep_texture_pathnames = config_egg2sg.GetBool("egg-keep-texture-pathna
 CoordinateSystem egg_coordinate_system;
 CoordinateSystem egg_coordinate_system;
 
 
 ConfigureFn(config_egg2sg) {
 ConfigureFn(config_egg2sg) {
+  init_libegg2sg();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libegg2sg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libegg2sg() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   LoaderFileTypeEgg::init_type();
   LoaderFileTypeEgg::init_type();
 
 
   string csstr = config_egg2sg.GetString("egg-coordinate-system", "default");
   string csstr = config_egg2sg.GetString("egg-coordinate-system", "default");

+ 1 - 1
panda/src/egg2sg/config_egg2sg.h

@@ -41,6 +41,6 @@ extern EXPCL_PANDAEGG bool egg_flatten_siblings;
 extern EXPCL_PANDAEGG bool egg_show_collision_solids;
 extern EXPCL_PANDAEGG bool egg_show_collision_solids;
 extern EXPCL_PANDAEGG bool egg_keep_texture_pathnames;
 extern EXPCL_PANDAEGG bool egg_keep_texture_pathnames;
 
 
-
+extern EXPCL_PANDAEGG void init_libegg2sg();
 
 
 #endif
 #endif

+ 1 - 0
panda/src/express/Sources.pp

@@ -6,6 +6,7 @@
   #define TARGET express
   #define TARGET express
   #define USE_NSPR yes
   #define USE_NSPR yes
   #define USE_CRYPTO yes
   #define USE_CRYPTO yes
+  #define USE_NET yes
 
 
   #define SOURCES							\
   #define SOURCES							\
     bigEndian.I bigEndian.cxx bigEndian.h buffer.I buffer.cxx buffer.h	\
     bigEndian.I bigEndian.cxx bigEndian.h buffer.I buffer.cxx buffer.h	\

+ 3 - 3
panda/src/framework/framework.cxx

@@ -926,10 +926,10 @@ int framework_main(int argc, char *argv[]) {
   GraphicsPipe::resolve_modules();
   GraphicsPipe::resolve_modules();
 
 
   framework_cat.info() << "Known pipe types:" << endl;
   framework_cat.info() << "Known pipe types:" << endl;
-  GraphicsPipe::_factory.write_types(framework_cat.info(false), 2);
+  GraphicsPipe::get_factory().write_types(framework_cat.info(false), 2);
 
 
   // Create a window
   // Create a window
-  main_pipe = GraphicsPipe::_factory.
+  main_pipe = GraphicsPipe::get_factory().
     make_instance(InteractiveGraphicsPipe::get_class_type());
     make_instance(InteractiveGraphicsPipe::get_class_type());
 
 
   if (main_pipe == (GraphicsPipe*)0L) {
   if (main_pipe == (GraphicsPipe*)0L) {
@@ -942,7 +942,7 @@ int framework_main(int argc, char *argv[]) {
     << "Opened a '" << main_pipe->get_type().get_name()
     << "Opened a '" << main_pipe->get_type().get_name()
     << "' interactive graphics pipe." << endl;
     << "' interactive graphics pipe." << endl;
 
 
-  rib_pipe = GraphicsPipe::_factory.
+  rib_pipe = GraphicsPipe::get_factory().
     make_instance(NoninteractiveGraphicsPipe::get_class_type());
     make_instance(NoninteractiveGraphicsPipe::get_class_type());
 
 
   if (rib_pipe == (GraphicsPipe*)0L)
   if (rib_pipe == (GraphicsPipe*)0L)

+ 20 - 2
panda/src/glgsg/config_glgsg.cxx

@@ -54,8 +54,26 @@ parse_decal_type(const string &type) {
   return GDT_offset;
   return GDT_offset;
 }
 }
 
 
-
 ConfigureFn(config_glgsg) {
 ConfigureFn(config_glgsg) {
+  init_libglgsg();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libglgsg
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libglgsg() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   string decal_type = config_glgsg.GetString("gl-decal-type", "");
   string decal_type = config_glgsg.GetString("gl-decal-type", "");
   if (!decal_type.empty()) {
   if (!decal_type.empty()) {
     gl_decal_type = parse_decal_type(decal_type);
     gl_decal_type = parse_decal_type(decal_type);
@@ -65,7 +83,7 @@ ConfigureFn(config_glgsg) {
   GLSavedFrameBuffer::init_type();
   GLSavedFrameBuffer::init_type();
   GLTextureContext::init_type();
   GLTextureContext::init_type();
 
 
-  GraphicsStateGuardian::_factory.register_factory
+  GraphicsStateGuardian::get_factory().register_factory
     (GLGraphicsStateGuardian::get_class_type(),
     (GLGraphicsStateGuardian::get_class_type(),
      GLGraphicsStateGuardian::make_GlGraphicsStateGuardian);
      GLGraphicsStateGuardian::make_GlGraphicsStateGuardian);
 }
 }

+ 2 - 0
panda/src/glgsg/config_glgsg.h

@@ -26,4 +26,6 @@ enum GLDecalType {
 };
 };
 extern GLDecalType gl_decal_type;
 extern GLDecalType gl_decal_type;
 
 
+extern EXPCL_PANDAGL void init_libglgsg();
+
 #endif
 #endif

+ 2 - 2
panda/src/glutdisplay/config_glutdisplay.cxx

@@ -14,9 +14,9 @@ NotifyCategoryDef(glutdisplay, "display");
 
 
 ConfigureFn(config_glutdisplay) {
 ConfigureFn(config_glutdisplay) {
   glutGraphicsPipe::init_type();
   glutGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(glutGraphicsPipe::get_class_type(),
+  GraphicsPipe::get_factory().register_factory(glutGraphicsPipe::get_class_type(),
 					  glutGraphicsPipe::make_glutGraphicsPipe);
 					  glutGraphicsPipe::make_glutGraphicsPipe);
   glutGraphicsWindow::init_type();
   glutGraphicsWindow::init_type();
-  GraphicsWindow::_factory.register_factory(glutGraphicsWindow::get_class_type(),
+  GraphicsWindow::get_factory().register_factory(glutGraphicsWindow::get_class_type(),
 					    glutGraphicsWindow::make_GlutGraphicsWindow);
 					    glutGraphicsWindow::make_GlutGraphicsWindow);
 }
 }

+ 2 - 2
panda/src/glxdisplay/config_glxdisplay.cxx

@@ -15,10 +15,10 @@ NotifyCategoryDef(glxdisplay, "display");
 
 
 ConfigureFn(config_glxdisplay) {
 ConfigureFn(config_glxdisplay) {
   glxGraphicsPipe::init_type();
   glxGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(glxGraphicsPipe::get_class_type(),
+  GraphicsPipe::get_factory().register_factory(glxGraphicsPipe::get_class_type(),
 					  glxGraphicsPipe::make_glxGraphicsPipe);
 					  glxGraphicsPipe::make_glxGraphicsPipe);
   glxGraphicsWindow::init_type();
   glxGraphicsWindow::init_type();
-  GraphicsWindow::_factory.register_factory(glxGraphicsWindow::get_class_type(),
+  GraphicsWindow::get_factory().register_factory(glxGraphicsWindow::get_class_type(),
 					    glxGraphicsWindow::make_GlxGraphicsWindow);
 					    glxGraphicsWindow::make_GlxGraphicsWindow);
   glxDisplay::init_type();
   glxDisplay::init_type();
 }
 }

+ 42 - 20
panda/src/graph/config_graph.cxx

@@ -23,26 +23,7 @@ NotifyCategoryDef(graph, "");
 NotifyCategoryDef(wrt, graph_cat);
 NotifyCategoryDef(wrt, graph_cat);
 
 
 ConfigureFn(config_graph) {
 ConfigureFn(config_graph) {
-  BoundedObject::init_type();
-  NamedNode::init_type();
-  Node::init_type();
-  NodeRelation::init_type();
-  NodeTransition::init_type();
-  NodeAttribute::init_type();
-  OnOffTransition::init_type();
-  OnOffAttribute::init_type();
-  MultiNodeTransition::init_type();
-  MultiNodeAttribute::init_type();
-  ImmediateTransition::init_type();
-  ImmediateAttribute::init_type();
-
-  NodeRelation::register_with_factory();
-
-  //Registration of writeable object's creation
-  //functions with BamReader's factory
-  Node::register_with_read_factory();
-  NamedNode::register_with_read_factory();
-  NodeRelation::register_with_read_factory();
+  init_libgraph();
 }
 }
 
 
 // Set this true if you want to cache some of the work of computing
 // Set this true if you want to cache some of the work of computing
@@ -72,3 +53,44 @@ const bool paranoid_wrt = config_graph.GetBool("paranoid-wrt", false);
 // it cannot be turned on in NDEBUG mode.
 // it cannot be turned on in NDEBUG mode.
 const bool paranoid_graph = config_graph.GetBool("paranoid-graph", false);
 const bool paranoid_graph = config_graph.GetBool("paranoid-graph", false);
 
 
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libgraph
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libgraph() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
+  void init_last_graph_update();
+  init_last_graph_update();
+
+  BoundedObject::init_type();
+  NamedNode::init_type();
+  Node::init_type();
+  NodeRelation::init_type();
+  NodeTransition::init_type();
+  NodeAttribute::init_type();
+  OnOffTransition::init_type();
+  OnOffAttribute::init_type();
+  MultiNodeTransition::init_type();
+  MultiNodeAttribute::init_type();
+  ImmediateTransition::init_type();
+  ImmediateAttribute::init_type();
+
+  NodeRelation::register_with_factory();
+
+  //Registration of writeable object's creation
+  //functions with BamReader's factory
+  Node::register_with_read_factory();
+  NamedNode::register_with_read_factory();
+  NodeRelation::register_with_read_factory();
+}

+ 2 - 0
panda/src/graph/config_graph.h

@@ -18,4 +18,6 @@ extern const bool EXPCL_PANDA ambiguous_wrt_abort;
 extern const bool EXPCL_PANDA paranoid_wrt;
 extern const bool EXPCL_PANDA paranoid_wrt;
 extern const bool EXPCL_PANDA paranoid_graph;
 extern const bool EXPCL_PANDA paranoid_graph;
 
 
+extern EXPCL_PANDA void init_libgraph();
+
 #endif
 #endif

+ 35 - 6
panda/src/graph/nodeRelation.cxx

@@ -12,10 +12,39 @@
 
 
 TypeHandle NodeRelation::_type_handle;
 TypeHandle NodeRelation::_type_handle;
 
 
-LastGraphUpdate last_graph_update;
-
 Factory<NodeRelation> *NodeRelation::_factory = NULL;
 Factory<NodeRelation> *NodeRelation::_factory = NULL;
 
 
+typedef map<TypeHandle, UpdateSeq> LastGraphUpdate;
+static LastGraphUpdate *last_graph_update_map = NULL;
+
+////////////////////////////////////////////////////////////////////
+//     Function: last_graph_update
+//  Description: Returns a modifiable reference to the sequence number
+//               indicating the last update to the indicated type of
+//               graph.
+////////////////////////////////////////////////////////////////////
+UpdateSeq &
+last_graph_update(TypeHandle graph_type) {
+#ifndef NDEBUG
+  static UpdateSeq initial;
+  nassertr(last_graph_update_map != (LastGraphUpdate *)NULL, initial);
+#endif
+  return (*last_graph_update_map)[graph_type];
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_last_graph_update
+//  Description: Initializes the last_graph_update map.  This call
+//               must be made before last_graph_update() can be safely
+//               called.
+////////////////////////////////////////////////////////////////////
+void
+init_last_graph_update() {
+  if (last_graph_update_map == NULL) {
+    last_graph_update_map = new LastGraphUpdate;
+  }
+}
+
 // Following are a handful of local template functions that provide
 // Following are a handful of local template functions that provide
 // support for manipulating the list of arcs on nodes.  They are
 // support for manipulating the list of arcs on nodes.  They are
 // template functions because they work as well on UpRelationArcs as
 // template functions because they work as well on UpRelationArcs as
@@ -472,7 +501,7 @@ attach() {
 
 
   // Blow out the cache and increment the current update sequence.
   // Blow out the cache and increment the current update sequence.
   _net_transitions.clear();
   _net_transitions.clear();
-  _last_update = ++last_graph_update[_type];
+  _last_update = ++last_graph_update(_type);
 
 
   /*
   /*
   // If we have just added a new parent arc to a node that previously
   // If we have just added a new parent arc to a node that previously
@@ -532,7 +561,7 @@ detach() {
 
 
   // Blow out the cache and increment the current update sequence.
   // Blow out the cache and increment the current update sequence.
   _net_transitions.clear();
   _net_transitions.clear();
-  _last_update = ++last_graph_update[_type];
+  _last_update = ++last_graph_update(_type);
 
 
   /*
   /*
   // If we have just removed a parent arc from a node, leaving exactly
   // If we have just removed a parent arc from a node, leaving exactly
@@ -576,7 +605,7 @@ detach_below() {
 
 
   // Blow out the cache and increment the current update sequence.
   // Blow out the cache and increment the current update sequence.
   _net_transitions.clear();
   _net_transitions.clear();
-  _last_update = ++last_graph_update[_type];
+  _last_update = ++last_graph_update(_type);
 
 
   return result;
   return result;
 }
 }
@@ -598,7 +627,7 @@ changed_transition(TypeHandle trans_type) {
   if (_net_transitions != (NodeTransitionCache *)NULL) {
   if (_net_transitions != (NodeTransitionCache *)NULL) {
     _net_transitions->clear_transition(trans_type);
     _net_transitions->clear_transition(trans_type);
   }
   }
-  _last_update = ++last_graph_update[get_type()];
+  _last_update = ++last_graph_update(get_type());
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 3 - 4
panda/src/graph/nodeRelation.h

@@ -26,12 +26,11 @@
 
 
 class Node;
 class Node;
 
 
-// This structure keeps a monotonically incrementing sequence number
+// This function keeps a monotonically incrementing sequence number
 // for each change made to the graph, for the purpose of invalidating
 // for each change made to the graph, for the purpose of invalidating
 // wrt cache values.  A different sequence number is kept for each
 // wrt cache values.  A different sequence number is kept for each
-// type of graph, hence the map.
-typedef map<TypeHandle, UpdateSeq> LastGraphUpdate;
-extern LastGraphUpdate EXPCL_PANDA last_graph_update;
+// type of graph, hence the parameter.
+extern EXPCL_PANDA UpdateSeq &last_graph_update(TypeHandle graph_type);
 
 
 ///////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////
 // 	 Class : NodeRelation
 // 	 Class : NodeRelation

+ 1 - 1
panda/src/graph/wrt.I

@@ -394,7 +394,7 @@ cached_wrt_base(const Node *from,
 		TransitionWrapper &result,
 		TransitionWrapper &result,
 		TypeHandle graph_type) {
 		TypeHandle graph_type) {
 
 
-  UpdateSeq now = last_graph_update[graph_type];
+  UpdateSeq now = last_graph_update(graph_type);
 
 
   TransitionWrapper net_from_trans = TransitionWrapper::init_from(result);
   TransitionWrapper net_from_trans = TransitionWrapper::init_from(result);
 
 

+ 1 - 1
panda/src/pandabase/pandasymbols.h

@@ -10,7 +10,7 @@
 
 
 /* See dtoolsymbols.h for a rant on the purpose of this file.  */
 /* See dtoolsymbols.h for a rant on the purpose of this file.  */
 
 
-#if defined(WIN32_VC) && !defined(CPPPARSER)
+#if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
 
 
 #ifdef BUILDING_PANDA
 #ifdef BUILDING_PANDA
   #define EXPCL_PANDA __declspec(dllexport)
   #define EXPCL_PANDA __declspec(dllexport)

+ 19 - 0
panda/src/pnmimage/config_pnmimage.cxx

@@ -12,5 +12,24 @@ Configure(config_pnmimage);
 NotifyCategoryDef(pnmimage, "");
 NotifyCategoryDef(pnmimage, "");
 
 
 ConfigureFn(config_pnmimage) {
 ConfigureFn(config_pnmimage) {
+  init_libpnmimage();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpnmimage
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpnmimage() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   PNMFileType::init_type();
   PNMFileType::init_type();
 }
 }

+ 2 - 0
panda/src/pnmimage/config_pnmimage.h

@@ -11,4 +11,6 @@
 
 
 NotifyCategoryDecl(pnmimage, EXPCL_PANDA, EXPTP_PANDA);
 NotifyCategoryDecl(pnmimage, EXPCL_PANDA, EXPTP_PANDA);
 
 
+extern EXPCL_PANDA void init_libpnmimage();
+
 #endif
 #endif

+ 3 - 0
panda/src/pnmimagetypes/Sources.pp

@@ -22,5 +22,8 @@
   #define IF_JPEG_SOURCES \
   #define IF_JPEG_SOURCES \
     pnmFileTypeJPG.cxx pnmFileTypeJPGReader.cxx pnmFileTypeJPGWriter.cxx
     pnmFileTypeJPG.cxx pnmFileTypeJPGReader.cxx pnmFileTypeJPGWriter.cxx
 
 
+  #define INSTALL_HEADERS \
+    config_pnmimagetypes.h
+
 #end lib_target
 #end lib_target
 
 

+ 20 - 0
panda/src/pnmimagetypes/config_pnmimagetypes.cxx

@@ -72,6 +72,26 @@ const int jpeg_scale_num = config_pnmimagetypes.GetInt("jpeg-scale-num", 1);
 const int jpeg_scale_denom = config_pnmimagetypes.GetInt("jpeg-scale-denom", 1);
 const int jpeg_scale_denom = config_pnmimagetypes.GetInt("jpeg-scale-denom", 1);
 
 
 ConfigureFn(config_pnmimagetypes) {
 ConfigureFn(config_pnmimagetypes) {
+  init_libpnmimagetypes();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libpnmimagetypes
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libpnmimagetypes() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
+  init_libpnmimage();
   PNMFileTypePNM::init_type();
   PNMFileTypePNM::init_type();
   PNMFileTypeSGI::init_type();
   PNMFileTypeSGI::init_type();
   PNMFileTypeAlias::init_type();
   PNMFileTypeAlias::init_type();

+ 2 - 0
panda/src/pnmimagetypes/config_pnmimagetypes.h

@@ -41,4 +41,6 @@ extern IMGHeaderType img_header_type;
 extern const int img_xsize;
 extern const int img_xsize;
 extern const int img_ysize;
 extern const int img_ysize;
 
 
+extern EXPCL_PANDA void init_libpnmimagetypes();
+
 #endif
 #endif

+ 2 - 2
panda/src/ribdisplay/config_ribdisplay.cxx

@@ -14,9 +14,9 @@ NotifyCategoryDef(ribdisplay, "display");
 
 
 ConfigureFn(config_ribdisplay) {
 ConfigureFn(config_ribdisplay) {
   RIBGraphicsPipe::init_type();
   RIBGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(RIBGraphicsPipe::get_class_type(),
+  GraphicsPipe::get_factory().register_factory(RIBGraphicsPipe::get_class_type(),
 					  RIBGraphicsPipe::make_RIBGraphicsPipe);
 					  RIBGraphicsPipe::make_RIBGraphicsPipe);
   RIBGraphicsWindow::init_type();
   RIBGraphicsWindow::init_type();
-  GraphicsWindow::_factory.register_factory(RIBGraphicsWindow::get_class_type(),
+  GraphicsWindow::get_factory().register_factory(RIBGraphicsWindow::get_class_type(),
 					     RIBGraphicsWindow::make_RibGraphicsWindow);
 					     RIBGraphicsWindow::make_RibGraphicsWindow);
 }
 }

+ 1 - 1
panda/src/ribgsg/config_ribgsg.cxx

@@ -13,7 +13,7 @@ NotifyCategoryDef(ribgsg, ":display:gsg");
 
 
 ConfigureFn(config_ribgsg) {
 ConfigureFn(config_ribgsg) {
   RIBGraphicsStateGuardian::init_type();
   RIBGraphicsStateGuardian::init_type();
-  GraphicsStateGuardian::_factory.
+  GraphicsStateGuardian::get_factory().
     register_factory(RIBGraphicsStateGuardian::get_class_type(),
     register_factory(RIBGraphicsStateGuardian::get_class_type(),
 		     RIBGraphicsStateGuardian::make_RIBGraphicsStateGuardian);
 		     RIBGraphicsStateGuardian::make_RIBGraphicsStateGuardian);
 }
 }

+ 1 - 1
panda/src/sgiglxdisplay/config_sgiglxdisplay.cxx

@@ -13,6 +13,6 @@ NotifyCategoryDef(sgiglxdisplay, "display");
 
 
 ConfigureFn(config_sgiglxdisplay) {
 ConfigureFn(config_sgiglxdisplay) {
   SgiGlxGraphicsPipe::init_type();
   SgiGlxGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(SgiGlxGraphicsPipe::get_class_type(),
+  GraphicsPipe::get_factory().register_factory(SgiGlxGraphicsPipe::get_class_type(),
 					  SgiGlxGraphicsPipe::make_sgiglxgraphicspipe);
 					  SgiGlxGraphicsPipe::make_sgiglxgraphicspipe);
 }
 }

+ 2 - 1
panda/src/sgraph/Sources.pp

@@ -16,7 +16,8 @@
     renderTraverser.I renderTraverser.cxx renderTraverser.h
     renderTraverser.I renderTraverser.cxx renderTraverser.h
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
-    camera.I camera.h geomNode.I geomNode.h geomTransformer.I \
+    camera.I camera.h config_sgraph.h \
+    geomNode.I geomNode.h geomTransformer.I \
     geomTransformer.h modelNode.I modelNode.h modelRoot.I \
     geomTransformer.h modelNode.I modelNode.h modelRoot.I \
     modelRoot.h planeNode.I planeNode.h projectionNode.I \
     modelRoot.h planeNode.I planeNode.h projectionNode.I \
     projectionNode.h renderTraverser.I renderTraverser.h
     projectionNode.h renderTraverser.I renderTraverser.h

+ 22 - 0
panda/src/sgraph/config_sgraph.cxx

@@ -13,11 +13,33 @@
 #include "projectionNode.h"
 #include "projectionNode.h"
 
 
 #include <dconfig.h>
 #include <dconfig.h>
+#include <config_graph.h>
 
 
 Configure(config_sgraph);
 Configure(config_sgraph);
 NotifyCategoryDef(sgraph, "");
 NotifyCategoryDef(sgraph, "");
 
 
 ConfigureFn(config_sgraph) {
 ConfigureFn(config_sgraph) {
+  init_libsgraph();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libsgraph
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libsgraph() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
+  init_libgraph();
+
   RenderTraverser::init_type();
   RenderTraverser::init_type();
   GeomNode::init_type();
   GeomNode::init_type();
   Camera::init_type();
   Camera::init_type();

+ 2 - 0
panda/src/sgraph/config_sgraph.h

@@ -11,4 +11,6 @@
 
 
 NotifyCategoryDecl(sgraph, EXPCL_PANDA, EXPTP_PANDA);
 NotifyCategoryDecl(sgraph, EXPCL_PANDA, EXPTP_PANDA);
 
 
+extern EXPCL_PANDA void init_libsgraph();
+
 #endif
 #endif

+ 11 - 1
panda/src/testbed/Sources.pp

@@ -4,7 +4,17 @@
     framework putil collide loader sgmanip chan text chancfg cull \
     framework putil collide loader sgmanip chan text chancfg cull \
     pnmimage pnmimagetypes event effects shader graph gobj display \
     pnmimage pnmimagetypes event effects shader graph gobj display \
     mathutil sgattrib putil express light dgraph device tform sgraph \
     mathutil sgattrib putil express light dgraph device tform sgraph \
-    linmath pstatclient sgraphutil
+    linmath pstatclient sgraphutil panda
+
+#if $[LINK_ALL_STATIC]
+  // If we're statically linking, we need to explicitly link with
+  // at least one graphics renderer.
+  #define LOCAL_LIBS pandagl pandadx $[LOCAL_LIBS]
+
+  // And we might like to have the egg loader available.
+  #define LOCAL_LIBS pandaegg $[LOCAL_LIBS]
+#endif
+
 #define UNIX_SYS_LIBS m
 #define UNIX_SYS_LIBS m
 
 
 
 

+ 30 - 1
panda/src/testbed/demo.cxx

@@ -40,7 +40,19 @@
 #include <pta_Colorf.h>
 #include <pta_Colorf.h>
 #include <pta_float.h>
 #include <pta_float.h>
 #include <pt_Node.h>
 #include <pt_Node.h>
-
+#include <panda.h>
+
+// If we're doing a static link, we should explicitly initialize some
+// of our external libraries, or they may not get linked in.
+#ifdef LINK_ALL_STATIC
+  #ifdef HAVE_GL
+    #include <pandagl.h>
+  #endif
+  #ifdef HAVE_DX
+    #include <pandadx.h>
+  #endif
+  #include <pandaegg.h>
+#endif
 
 
 //From framework
 //From framework
 extern PT(GeomNode) geomnode;
 extern PT(GeomNode) geomnode;
@@ -578,6 +590,23 @@ void demo_keys(EventHandler&) {
 }
 }
 
 
 int main(int argc, char *argv[]) {
 int main(int argc, char *argv[]) {
+  // We call init_libpanda() to be paranoid.  It's not supposed to be
+  // necessary, but it turns out that static init isn't dependable in
+  // all cases.
+  init_libpanda();
+
+  // If we're doing a static link, we should explicitly initialize some
+  // of our external libraries, or they may not get linked in.
+#ifdef LINK_ALL_STATIC
+  #ifdef HAVE_GL
+  init_libpandagl();
+  #endif
+  #ifdef HAVE_DX
+  init_libpandadx();
+  #endif
+  init_libpandaegg();
+#endif
+
   define_keys = &demo_keys;
   define_keys = &demo_keys;
   return framework_main(argc, argv);
   return framework_main(argc, argv);
 }
 }

+ 1 - 1
panda/src/wdxdisplay/Sources.pp

@@ -14,7 +14,7 @@
     wdxGraphicsPipe.h wdxGraphicsWindow.cxx wdxGraphicsWindow.h
     wdxGraphicsPipe.h wdxGraphicsWindow.cxx wdxGraphicsWindow.h
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
-    wdxGraphicsPipe.h wdxGraphicsWindow.h
+    config_wdxdisplay.h wdxGraphicsPipe.h wdxGraphicsWindow.h
 
 
 #end lib_target
 #end lib_target
 
 

+ 21 - 2
panda/src/wdxdisplay/config_wdxdisplay.cxx

@@ -13,12 +13,31 @@ Configure(config_wdxdisplay);
 NotifyCategoryDef(wdxdisplay, "display");
 NotifyCategoryDef(wdxdisplay, "display");
 
 
 ConfigureFn(config_wdxdisplay) {
 ConfigureFn(config_wdxdisplay) {
+  init_libwdxdisplay();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libwdxdisplay
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libwdxdisplay() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   wdxGraphicsPipe::init_type();
   wdxGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(
+  GraphicsPipe::get_factory().register_factory(
 			wdxGraphicsPipe::get_class_type(),
 			wdxGraphicsPipe::get_class_type(),
 		  	wdxGraphicsPipe::make_wdxGraphicsPipe);
 		  	wdxGraphicsPipe::make_wdxGraphicsPipe);
   wdxGraphicsWindow::init_type();
   wdxGraphicsWindow::init_type();
-  GraphicsWindow::_factory.register_factory(
+  GraphicsWindow::get_factory().register_factory(
 			wdxGraphicsWindow::get_class_type(),
 			wdxGraphicsWindow::get_class_type(),
 		    	wdxGraphicsWindow::make_wdxGraphicsWindow);
 		    	wdxGraphicsWindow::make_wdxGraphicsWindow);
 }
 }

+ 1 - 0
panda/src/wdxdisplay/config_wdxdisplay.h

@@ -11,5 +11,6 @@
 
 
 NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
 NotifyCategoryDecl(wdxdisplay, EXPCL_PANDADX, EXPTP_PANDADX);
 
 
+extern EXPCL_PANDADX void init_libwdxdisplay();
 
 
 #endif /* __CONFIG_WDXDISPLAY_H__ */
 #endif /* __CONFIG_WDXDISPLAY_H__ */

+ 1 - 1
panda/src/wgldisplay/Sources.pp

@@ -13,7 +13,7 @@
     wglGraphicsPipe.h wglGraphicsWindow.cxx wglGraphicsWindow.h
     wglGraphicsPipe.h wglGraphicsWindow.cxx wglGraphicsWindow.h
 
 
   #define INSTALL_HEADERS \
   #define INSTALL_HEADERS \
-    wglGraphicsPipe.h wglGraphicsWindow.h
+     config_wgldisplay.h wglGraphicsPipe.h wglGraphicsWindow.h
 
 
 #end lib_target
 #end lib_target
 
 

+ 21 - 2
panda/src/wgldisplay/config_wgldisplay.cxx

@@ -13,12 +13,31 @@ Configure(config_wgldisplay);
 NotifyCategoryDef(wgldisplay, "display");
 NotifyCategoryDef(wgldisplay, "display");
 
 
 ConfigureFn(config_wgldisplay) {
 ConfigureFn(config_wgldisplay) {
+  init_libwgldisplay();
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: init_libwgldisplay
+//  Description: Initializes the library.  This must be called at
+//               least once before any of the functions or classes in
+//               this library can be used.  Normally it will be
+//               called by the static initializers and need not be
+//               called explicitly, but special cases exist.
+////////////////////////////////////////////////////////////////////
+void
+init_libwgldisplay() {
+  static bool initialized = false;
+  if (initialized) {
+    return;
+  }
+  initialized = true;
+
   wglGraphicsPipe::init_type();
   wglGraphicsPipe::init_type();
-  GraphicsPipe::_factory.register_factory(
+  GraphicsPipe::get_factory().register_factory(
 			wglGraphicsPipe::get_class_type(),
 			wglGraphicsPipe::get_class_type(),
 		  	wglGraphicsPipe::make_wglGraphicsPipe);
 		  	wglGraphicsPipe::make_wglGraphicsPipe);
   wglGraphicsWindow::init_type();
   wglGraphicsWindow::init_type();
-  GraphicsWindow::_factory.register_factory(
+  GraphicsWindow::get_factory().register_factory(
 			wglGraphicsWindow::get_class_type(),
 			wglGraphicsWindow::get_class_type(),
 		    	wglGraphicsWindow::make_wglGraphicsWindow);
 		    	wglGraphicsWindow::make_wglGraphicsWindow);
 }
 }

+ 1 - 0
panda/src/wgldisplay/config_wgldisplay.h

@@ -11,5 +11,6 @@
 
 
 NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
 NotifyCategoryDecl(wgldisplay, EXPCL_PANDAGL, EXPTP_PANDAGL);
 
 
+extern EXPCL_PANDAGL void init_libwgldisplay();
 
 
 #endif /* __CONFIG_WGLDISPLAY_H__ */
 #endif /* __CONFIG_WGLDISPLAY_H__ */