1 ### EnTT and shared libraries
3 To make sure that an application and a shared library that use both `EnTT` can
4 interact correctly when symbols are hidden by default, there are some tricks to
6 In particular and in order to avoid undefined behaviors, all the instantiation
7 of the `Family` class template shall be made explicit along with the system-wide
8 specifier to use to export them.
10 At the time I'm writing this document, the classes that use internally the above
11 mentioned class template are `Dispatcher`, `Emitter` and `Registry`. Therefore
12 and as an example, if you use the `Registry` class template in your shared
13 library and want to set symbols visibility to _hidden_ by default, the following
14 lines are required to allow it to function properly with a client that also uses
15 the `Registry` somehow:
21 template class __attribute__((visibility("default"))) Family<struct InternalRegistryTagFamily>;
22 template class __attribute__((visibility("default"))) Family<struct InternalRegistryComponentFamily>;
23 template class __attribute__((visibility("default"))) Family<struct InternalRegistryHandlerFamily>;
31 template class __declspec(dllexport) Family<struct InternalRegistryTagFamily>;
32 template class __declspec(dllexport) Family<struct InternalRegistryComponentFamily>;
33 template class __declspec(dllexport) Family<struct InternalRegistryHandlerFamily>;
37 Otherwise, the risk is that type identifiers are different between the shared
38 library and the application and this will prevent the whole thing from
39 functioning correctly for obvious reasons.