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:
Sam Haves
2026-04-08 11:34:33 -07:00
committed by Copybara-Service
parent 33fd2fe40e
commit f2461f9ce6
14 changed files with 60 additions and 53 deletions
+4
View File
@@ -44,6 +44,10 @@ General
- The ``vertcollide`` field in :ref:`mjsFlex` has been removed. It is no longer required since
:doc:`MuJoCo Warp <mjwarp/index>` supports native flex collisions.
- :ref:`mjPLUGIN_LIB_INIT` macro now requires a name argument to avoid initialization function name collisions.
When building with MSVC, we now use the C runtime initialization section to initialize plugins instead of
``DllMain``. See :ref:`plugin registration<exRegistration>` for more details.
- The :ref:`mjtWarning` enum value ``mjWARN_VGEOMFULL`` is removed. Exhaustion of visual geoms is now handled
internally by the :ref:`mjvScene`.