Open AlexanderFabisch opened 6 years ago
@arneboe to inform you.
To fix the first problem you can change ENVIRE_REGISTER_METADATA
to:
#define ENVIRE_REGISTER_METADATA( _classname, _datatype, _unique_id ) \
static envire::core::MetadataInitializer _metadataInit##_unique_id(typeid(_classname), #_datatype, #_classname);
And then call it with ENVIRE_REGISTER_METADATA( _classname, _datatype, __COUNTER__ )
to get a unique variable name.
For the second we would need to implement the support to load typekit plugins in envire.
I open this issue to keep track of the current state of the discussion.
Registering multiple item types in one file is currently not possible, e.g.
The reason is that
ENVIRE_REGISTER_METADATA
expands towhich means that
_metadataInit
is declared more than once. We cannot simply rename it to_metadataInit##_datatype
because_datatype
might contain namespaces (::
). One option would be to define an additional macroENVIRE_REGISTER_ITEM(_datatype, _variableName)
.Unfortunately I cannot really use this in my use case because at the moment I need ENVIRE_REGISTER_ITEM without the serialization feature because there is no boost serialization for the basetypes that I want to register.
My temporary solution for both problems is
As soon as there is boost serialization functionality for basetypes, I would implement
ENVIRE_REGISTER_ITEM(_datatype, _variableName)
.But maybe there is a completely different solution to run code once after starting the program that does not rely on some static variable that is defined in the file.