]> Creatis software - cpPlugins.git/blobdiff - appli/bash/cpPlugins_HostCreator.cxx
... and on linux again
[cpPlugins.git] / appli / bash / cpPlugins_HostCreator.cxx
index 445302fe9090bbe5d03d3f4664e96492dc56f070..4fbadeda1c40aad8d92218936dce123fd47b8d93 100644 (file)
@@ -113,10 +113,16 @@ int main( int argc, char* argv[] )
      << "{" << std::endl << "}" << std::endl;
   */
 
+#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+  std::string export_prefix = "__declspec(dllexport)";
+#else // defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+  std::string export_prefix = "__attribute__((visibility(\"default\")))";
+#endif // defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
+
   // Write access function
   out_stream
     << std::endl
-    << "extern \"C\" __declspec(dllexport) const char* "
+    << "extern \"C\" " << export_prefix << " const char* "
     << "cpPlugins_LoadedFilters( )" << std::endl << "{" << std::endl
     << "  static std::string classes;"
     << std::endl
@@ -136,7 +142,7 @@ int main( int argc, char* argv[] )
     for( auto jIt = iIt->second.begin( ); jIt != iIt->second.end( ); ++jIt )
     {
       out_stream
-        << "extern \"C\" __declspec(dllexport) void* "
+        << "extern \"C\" " << export_prefix << " void* "
         << iIt->first << "_" << jIt->first
         << "( )" << std::endl << "{" << std::endl
         << "  static " << jIt->second << "::" << jIt->first << "::Pointer f;" << std::endl