Closed
Description
In the tinyxml2 header file embedded in the BehaviorTree.CPP library, there is the macro:
// Do NOT export. This version is meant to be linked statically only.
#define TINYXML2_LIB
Using gcc, the default behavior is to export the tinyxml2 symbols from the BehaviorTree.CPP library, so the problem remains that this embedded version of the library can be picked up when linking if the application uses (another version of) tinyxml2.
Therefore, this should be used in the gcc case:
#define TINYXML2_LIB __attribute__((visibility("hidden")))
This prevents the symbols from being exported (you can confirm this with the nm utility).
So, I recommend the following:
#ifdef _WIN32
# ifdef TINYXML2_EXPORT
# define TINYXML2_LIB __declspec(dllexport)
# elif defined(TINYXML2_IMPORT)
# define TINYXML2_LIB __declspec(dllimport)
# else
# define TINYXML2_LIB
# endif
#elif __GNUC__ >= 4
# ifdef TINYXML2_EXPORT
# define TINYXML2_LIB __attribute__((visibility("default")))
# else
# define TINYXML2_LIB __attribute__((visibility("hidden")))
# endif
#else
# define TINYXML2_LIB
#endif
Metadata
Metadata
Assignees
Labels
No labels