diff --git a/panda/src/net/config_net.cxx b/panda/src/net/config_net.cxx index f622465e28..4d621a60c3 100644 --- a/panda/src/net/config_net.cxx +++ b/panda/src/net/config_net.cxx @@ -13,6 +13,25 @@ Configure(config_net); NotifyCategoryDef(net, ""); ConfigureFn(config_net) { + init_libnet(); +} + +//////////////////////////////////////////////////////////////////// +// Function: init_libnet +// 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_libnet() { + static bool initialized = false; + if (initialized) { + return; + } + initialized = true; + NetDatagram::init_type(); } diff --git a/panda/src/net/config_net.h b/panda/src/net/config_net.h index 20b744ee8e..da2f5289f1 100644 --- a/panda/src/net/config_net.h +++ b/panda/src/net/config_net.h @@ -17,4 +17,7 @@ extern int get_net_max_write_queue(); extern int get_net_max_response_queue(); extern bool get_net_error_abort(); +extern EXPCL_PANDA void init_libnet(); + #endif +