diff --git a/libmexlibczi/CMakeLists.txt b/libmexlibczi/CMakeLists.txt index 9a51670..db75437 100644 --- a/libmexlibczi/CMakeLists.txt +++ b/libmexlibczi/CMakeLists.txt @@ -17,6 +17,6 @@ if(WIN32) #set_target_properties(MatlabCZI PROPERTIES SUFFIX ".mexw64") elseif(UNIX) #set_target_properties(MatlabCZI PROPERTIES SUFFIX ".mexa64") - target_link_options(libmexlibczi PRIVATE -static-libgcc -static-libstdc++ ) + #target_link_options(libmexlibczi PRIVATE -static-libgcc -static-libstdc++ ) set_target_properties(MatlabCZI PROPERTIES PREFIX "") # otherwise "lib" is prepended endif() \ No newline at end of file diff --git a/libmexlibczi/DllMain.cpp b/libmexlibczi/DllMain.cpp index b9c475f..95630c1 100644 --- a/libmexlibczi/DllMain.cpp +++ b/libmexlibczi/DllMain.cpp @@ -1,3 +1,4 @@ +#if _WIN32 #include BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) @@ -23,3 +24,4 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv return TRUE; } +#endif \ No newline at end of file diff --git a/libmexlibczi/exportedfunctions.cpp b/libmexlibczi/exportedfunctions.cpp index 02dd50a..51b3e19 100644 --- a/libmexlibczi/exportedfunctions.cpp +++ b/libmexlibczi/exportedfunctions.cpp @@ -1,16 +1,22 @@ #include -extern "C" __declspec(dllexport) void mexFunction(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], IAppExtensionFunctions* app_functions) +#ifdef __GNUC__ +#define DLLEXPORT __attribute__((visibility("default"))) +#else +#define DLLEXPORT __declspec(dllexport) +#endif + +extern "C" DLLEXPORT void mexFunction(int nlhs, Parameter plhs[], int nrhs, const Parameter prhs[], IAppExtensionFunctions* app_functions) { mexlibCZI::mexFunction(nlhs, plhs, nrhs, prhs, app_functions); } -extern "C" __declspec(dllexport) void OnInitialize() +extern "C" DLLEXPORT void OnInitialize() { mexlibCZI::OnInitialize(); } -extern "C" __declspec(dllexport) void OnShutdown() +extern "C" DLLEXPORT void OnShutdown() { mexlibCZI::OnShutdown(); }