-
Notifications
You must be signed in to change notification settings - Fork 19
Description
I was trying to compile the Vamp plugin from Essentia, running into the problem with the missing __declspec(dllexport). As described in README.msvc, I had to edit the vamp.h header to match Essentias linkage specification, see examples/vampplugins.cpp (ESSENTIA_API expands to __declspec(dllexport))
I was wondering if you'd accept a pull request to make this work out of the box. While the following section of the README.msvc isn't wrong
This is not present by default, because it isn't portable among compilers and, as we only want one symbol exported, the above linker option works equally well without code changes.
the problem is fairly easy to solve in a portable manner. The commonly used solution looks something like
#if (defined(_WIN32))
# ifdef VAMP_NODLL
# define VAMP_API
# else
# ifdef VAMP_API_IMPORTS
# define VAMP_API __declspec(dllimport)
# else
# define VAMP_API __declspec(dllexport)
# endif
# endif
#else
# if __GNUC__ >= 4
# define VAMP_API __attribute__ ((visibility("default")))
# else
# define VAMP_API
# endif
#endif
const VAMP_API VampPluginDescriptor *vampGetPluginDescriptor
(unsigned int hostApiVersion, unsigned int index);On Windows, this automatically sets the required export attribute. Please let me know whether I should do a PR!