Is it possible to define this as a preprocessor definition? I'm trying to do this:
#if defined _WIN32
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT
#endif
so that I can build this library for both Mac and Windows. There's a function which needs a __declspec(dllexport)
when it's on Windows, but I don't need it when I'm building on Mac. So this is what I tried doing.
As I suspected, it gives me an error when building because it doesn't like the parenthesis, yet I've seen other people do it. See here or here. Is there something I'm doing wrong or another way to achieve what I'm trying to do?
Edit: here's the error I get when trying to build on Windows (haven't tried on Mac yet).
error: expected constructor, destructor, or type conversion before '(' token
38 | #define DLL_EXPORT __declspec(dllexport)
| ^
note: in expansion of macro 'DLL_EXPORT'
94 | extern "C" DLL_EXPORT int process(const float* inputData, float* outputData)
| ^~~~~~
And I use mingw gcc to compile.