Modify mj_PLUGIN_LIB_INIT to support multiple plugins in the same compilation unit.
Previously on MSVC we used DllMain to register plugins, you cannot have multiple definitions of DllMain in a single unit so you would get errors if you tried to register two plugins. This modifies the implementation to insert a function pointer into the C runtime initialization instead. PiperOrigin-RevId: 896612678 Change-Id: I07732147b955d741c836acff6da986db0e9b9eff
This commit is contained in:
committed by
Copybara-Service
parent
33fd2fe40e
commit
f2461f9ce6
@@ -192,7 +192,7 @@ static mjSpec* ParseZipBuffer(const void* buffer, int nbuffer, const char* name,
|
||||
return mj_parseXML(root.c_str(), vfs, error, error_sz);
|
||||
}
|
||||
|
||||
mjPLUGIN_LIB_INIT {
|
||||
mjPLUGIN_LIB_INIT(mjz_decoder) {
|
||||
mjpDecoder decoder;
|
||||
decoder.content_type = "application/zip";
|
||||
decoder.extension = ".mjz|.zip";
|
||||
|
||||
@@ -238,7 +238,7 @@ void Renderer::UpdateFps() {
|
||||
|
||||
} // namespace mujoco::platform
|
||||
|
||||
mjPLUGIN_LIB_INIT {
|
||||
mjPLUGIN_LIB_INIT(renderer) {
|
||||
mujoco::platform::GuiPlugin plugin;
|
||||
plugin.name = "Filament";
|
||||
plugin.update = [](mujoco::platform::GuiPlugin* self) {
|
||||
|
||||
@@ -175,7 +175,7 @@ class ObjectLauncher {
|
||||
|
||||
} // namespace mujoco::studio
|
||||
|
||||
mjPLUGIN_LIB_INIT {
|
||||
mjPLUGIN_LIB_INIT(object_launcher) {
|
||||
using mujoco::studio::ObjectLauncher;
|
||||
|
||||
static ObjectLauncher plugin;
|
||||
|
||||
Reference in New Issue
Block a user