Template alternative to ML_EXPORT for registering Malena types in .cpp files.
More...
#include <MLExport.h>
Template alternative to ML_EXPORT for registering Malena types in .cpp files.
MLExport<T> provides the same registration behaviour as ML_EXPORT but uses explicit template instantiation syntax rather than a macro. Use it in a .cpp file:
This is exactly equivalent to:
| Scenario | Use |
|---|---|
| Registration in a header file | ML_EXPORT — uses inline struct, ODR-safe |
Registration in a .cpp file | Either — MLExport or ML_EXPORT both work |
| Prefer no macros | MLExport + explicit instantiation |
Forcing instantiation of MLExport<T> causes Registrar's constructor to run exactly once before main(). For Fireable types it calls Fireable::_register with a new singleton instance. For non-Fireable non-Plugin types a static_assert fires at compile time. Plugin extern "C" symbols are handled by the ML_EXPORT macro's plugin block — MLExport does not emit them, so plugins must use ML_EXPORT.
| T | The type to register. Must derive from ml::Fireable. For ml::Plugin types use ML_EXPORT instead. |
Definition at line 73 of file MLExport.h.