diff d2/qtd/Core.d @ 384:d2f48c4cb3e3

Same behavior of shared libs on linux and windows. Minor build script fixes.
author Max Samukha <maxter@spambox.com>
date Fri, 16 Jul 2010 20:04:29 +0300
parents a032df77b6ab
children 7dddafad5a20
line wrap: on
line diff
--- a/d2/qtd/Core.d	Mon Jul 12 22:50:58 2010 +0300
+++ b/d2/qtd/Core.d	Fri Jul 16 20:04:29 2010 +0300
@@ -35,8 +35,6 @@
     alias T Type;
 }
 
-enum qtdExtern = "extern (C)";
-
 extern(C) alias void function() VoidFunc;
 extern(C) void qtdInitCore();
 
@@ -53,21 +51,27 @@
 string qtdExport(string retType, string name, string args, string funcBody)
 {
     string ret;
-    version (cpp_shared) // TODO: cpp_shared implies Windows, which is not correct
+    enum ext = "extern (C)";
+    version (QtdCppShared)
     {
+        version(Windows)
+            enum exp = "export";
+        else
+            enum exp = "";
+
         // TODO: hackery to workaround a dmd/optlink bug corrupting symbol names
         // when a direct function pointer export is used
         ret ~= format_ctfe(
             "    ${4} ${0} qtd_export_${1}(${2}) { ${3} }\n"
-            "    ${4} export void qtd_set_${1}(VoidFunc func);\n"
+            "    ${4} ${5} void qtd_set_${1}(VoidFunc func);\n"
             "    static this() { qtd_set_${1}(cast(VoidFunc)&qtd_export_${1}); }\n",
-            retType, name, args, funcBody, qtdExtern);
+            retType, name, args, funcBody, ext, exp);
     }
     else
     {
         ret = format_ctfe(
             "${4} ${0} qtd_${1}(${2}) { ${3} }\n",
-            retType, name, args, funcBody, qtdExtern);
+            retType, name, args, funcBody, ext);
     }
 
     return ret;