i think the canonical way to handle this is to use a define indicating a static build (and don't use the __declspec(dllexport) decorator if it is set), like so:
#ifdef FLITE_STATIC
# define GLOBALVARDEF
#else
# ifdef WIN32
/* For Visual Studio 2012 global variable definitions */
# define GLOBALVARDEF __declspec(dllexport)
# else
# define GLOBALVARDEF
# endif
#endif
obviously, whoever wants to link flite statically, will then have to define FLITE_STATIC.
it seems that it's impossible to create a
dll
that statically links against flite.the problem, is that for static builds you shouldn't export variables with
__declspec(dllexport)
, as found in https://github.com/festvox/flite/blob/6c9f20dc915b17f5619340069889db0aa007fcdc/include/flite.h#L68-L73 and https://github.com/festvox/flite/blob/6c9f20dc915b17f5619340069889db0aa007fcdc/src/synth/flite.c#L47-L52i think the canonical way to handle this is to use a define indicating a static build (and don't use the
__declspec(dllexport)
decorator if it is set), like so:obviously, whoever wants to link flite statically, will then have to define
FLITE_STATIC
.