Farid Zaripov wrote:
 > -----Original Message-----
 > From: Martin Sebor [mailto:[EMAIL PROTECTED]
 > Sent: Saturday, November 11, 2006 12:39 AM
 > To: [email protected]
 > Subject: Re: svn commit: r473351 - in
 > /incubator/stdcxx/trunk/etc/config: src/EXPORT.cpp
 > windows/configure.wsf windows/projects.js
 >
 > Is this necessary for the Windows infrastructure to work correctly?
Yes, it was. The './' has been replaced with path to stage directory (where the object files and lib files located).
 > I don't think it's needed on UNIX (AFAIK, it causes no
 > problems but I don't know why it's there) but if the Windows
 > linker needs it for some reason a better solution might be to
 > change the Windows scripts and remove it from here as well as
 > from all the other config tests that use it. Otherwise, it
 > might easily regress.

  I've removed them and modified the configure.wsf script.

Also I've updated the configure.wsf script to produce shared libraries (dll) from *.lib.cpp files.

  The diff file (etc.diff) is attached. ChangeLog is below.

Great, thanks for doing that. Assuming you've tested the changes
on both Windows and UNIX please go ahead and commit it.

Martin


  ChangeLog:
  * COLLAPSE_STATIC_LOCALS.cpp: Removed "./" from the LDOPTS.
  * COLLAPSE_TEMPLATE_LOCALS.cpp: Ditto.
  * COLLAPSE_TEMPLATE_STATICS.cpp: Ditto.
  * EXPORT.cpp: Ditto.
  * EXTERN_FUNCTION_TEMPLATE.cpp: Ditto.
  * EXTERN_INLINE.cpp: Ditto.
  * EXTERN_MEMBER_TEMPLATE.cpp: Ditto.
  * EXTERN_TEMPLATE.cpp: Ditto.
  * EXTERN_TEMPLATE_BEFORE_DEFINITION.cpp: Ditto.
  * IMPLICIT_INSTANTIATION.cpp: Ditto.
  * LIB_EXCEPTIONS.cpp: Ditto.
  * collapse_static_locals.lib.cpp (bar) [_WIN32 && _DLL]: Added
  __declspec (dllexport) to the function definition.
  * collapse_template_locals.lib.cpp (bar): Ditto.
  * collapse_template_statics.lib.cpp (bar): Ditto.
  * extern_inline.lib.cpp (foo): Ditto.
  * lib_exceptions.lib.cpp (foo): Ditto.
  * configure.wsf (runExeTests): Removed replacing the "./" in LDOPTS.
  (compileLibs): Added parameter: shared.
  (makeLibrary): Ditto. Added creation of the dynamic library (dll)
  instead of static library, if shared is true

Farid.


------------------------------------------------------------------------

Index: config/src/COLLAPSE_STATIC_LOCALS.cpp
===================================================================
--- config/src/COLLAPSE_STATIC_LOCALS.cpp       (revision 474707)
+++ config/src/COLLAPSE_STATIC_LOCALS.cpp       (working copy)
@@ -8,7 +8,7 @@
 #  ifndef _RWSTD_NO_collapse_static_locals.lib
// link this compiled translation unit with the lib below
-     // LDOPTS = ./collapse_static_locals.lib$(LIBSUFFIX)
+     // LDOPTS = collapse_static_locals.lib$(LIBSUFFIX)
# endif // _RWSTD_NO_collapse_static_locals.lib
 #endif   // 0
Index: config/src/collapse_static_locals.lib.cpp
===================================================================
--- config/src/collapse_static_locals.lib.cpp   (revision 474707)
+++ config/src/collapse_static_locals.lib.cpp   (working copy)
@@ -8,6 +8,9 @@
 }
// bar() returns foo()
+#if defined (_WIN32) && defined (_DLL)
+__declspec (dllexport)
+#endif  // _WIN32 && _DLL
 int bar ()
 {
     return foo ();
Index: config/src/COLLAPSE_TEMPLATE_LOCALS.cpp
===================================================================
--- config/src/COLLAPSE_TEMPLATE_LOCALS.cpp     (revision 474707)
+++ config/src/COLLAPSE_TEMPLATE_LOCALS.cpp     (working copy)
@@ -8,7 +8,7 @@
 #  ifndef _RWSTD_NO_collapse_template_locals.lib
// link this compiled translation unit with the lib below
-     // LDOPTS = ./collapse_template_locals.lib$(LIBSUFFIX)
+     // LDOPTS = collapse_template_locals.lib$(LIBSUFFIX)
# endif // _RWSTD_NO_collapse_template_locals.lib
 #endif   // 0
Index: config/src/collapse_template_locals.lib.cpp
===================================================================
--- config/src/collapse_template_locals.lib.cpp (revision 474707)
+++ config/src/collapse_template_locals.lib.cpp (working copy)
@@ -10,6 +10,9 @@
// bar() returns foo()
+#if defined (_WIN32) && defined (_DLL)
+__declspec (dllexport)
+#endif  // _WIN32 && _DLL
 int bar ()
 {
     return foo (0);
Index: config/src/COLLAPSE_TEMPLATE_STATICS.cpp
===================================================================
--- config/src/COLLAPSE_TEMPLATE_STATICS.cpp    (revision 474707)
+++ config/src/COLLAPSE_TEMPLATE_STATICS.cpp    (working copy)
@@ -8,7 +8,7 @@
 #  ifndef _RWSTD_NO_collapse_template_statics.lib
// link this compiled translation unit with the lib below
-     // LDOPTS = ./collapse_template_statics.lib$(LIBSUFFIX)
+     // LDOPTS = collapse_template_statics.lib$(LIBSUFFIX)
# endif // _RWSTD_NO_collapse_template_statics.lib
 #endif   // 0
Index: config/src/collapse_template_statics.lib.cpp
===================================================================
--- config/src/collapse_template_statics.lib.cpp        (revision 474707)
+++ config/src/collapse_template_statics.lib.cpp        (working copy)
@@ -11,6 +11,9 @@
 T S<T>::t;
+#if defined (_WIN32) && defined (_DLL)
+__declspec (dllexport)
+#endif  // _WIN32 && _DLL
 int bar ()
 {
     // S<int>::t instantiated and modified in COLLAPSE_TEMPLATE_STATICS.cpp
Index: config/src/EXPORT.cpp
===================================================================
--- config/src/EXPORT.cpp       (revision 474707)
+++ config/src/EXPORT.cpp       (working copy)
@@ -9,7 +9,7 @@
// establish a dependency on EXPORT_KEYWORD.cpp which must be
 // compiled first since it defines the exported function template
-// LDOPTS = ./EXPORT_KEYWORD.o +// LDOPTS = EXPORT_KEYWORD.o #endif // _RWSTD_NO_EXPORT_KEYWORD Index: config/src/EXTERN_FUNCTION_TEMPLATE.cpp
===================================================================
--- config/src/EXTERN_FUNCTION_TEMPLATE.cpp     (revision 474707)
+++ config/src/EXTERN_FUNCTION_TEMPLATE.cpp     (working copy)
@@ -9,7 +9,7 @@
// link the object file produced by compiling this file
 // with the object file below
-// LDOPTS = ./extern_function_template_imp.o
+// LDOPTS = extern_function_template_imp.o
#endif // _RWSTD_NO_extern_function_template_imp Index: config/src/EXTERN_INLINE.cpp
===================================================================
--- config/src/EXTERN_INLINE.cpp        (revision 474707)
+++ config/src/EXTERN_INLINE.cpp        (working copy)
@@ -8,7 +8,7 @@
 #  ifndef _RWSTD_NO_extern_inline.lib
// link this compiled translation unit with the lib below
-     // LDOPTS = ./extern_inline.lib$(LIBSUFFIX)
+     // LDOPTS = extern_inline.lib$(LIBSUFFIX)
# endif // _RWSTD_NO_extern_inline.lib
 #endif   // 0
Index: config/src/extern_inline.lib.cpp
===================================================================
--- config/src/extern_inline.lib.cpp    (revision 474707)
+++ config/src/extern_inline.lib.cpp    (working copy)
@@ -1,4 +1,7 @@
+#if defined (_WIN32) && defined (_DLL)
+__declspec (dllexport)
+#endif  // _WIN32 && _DLL
 extern inline int foo (int i)
 {
     return i + 1;
Index: config/src/EXTERN_MEMBER_TEMPLATE.cpp
===================================================================
--- config/src/EXTERN_MEMBER_TEMPLATE.cpp       (revision 474707)
+++ config/src/EXTERN_MEMBER_TEMPLATE.cpp       (working copy)
@@ -25,7 +25,7 @@
 #ifndef _RWSTD_NO_extern_template_imp
// link with the object file below
-// LDOPTS = ./extern_template_imp.o
+// LDOPTS = extern_template_imp.o
#endif // _RWSTD_NO_extern_template_imp Index: config/src/EXTERN_TEMPLATE.cpp
===================================================================
--- config/src/EXTERN_TEMPLATE.cpp      (revision 474707)
+++ config/src/EXTERN_TEMPLATE.cpp      (working copy)
@@ -15,7 +15,7 @@
 #ifndef _RWSTD_NO_extern_template_imp
// link with the object file below
-// LDOPTS = ./extern_template_imp.o
+// LDOPTS = extern_template_imp.o
#endif // _RWSTD_NO_extern_template_imp Index: config/src/EXTERN_TEMPLATE_BEFORE_DEFINITION.cpp
===================================================================
--- config/src/EXTERN_TEMPLATE_BEFORE_DEFINITION.cpp    (revision 474707)
+++ config/src/EXTERN_TEMPLATE_BEFORE_DEFINITION.cpp    (working copy)
@@ -7,7 +7,7 @@
 #ifndef _RWSTD_NO_extern_template_before_definition_imp
   // establish a dependency on the source file to get it
   // compiled first and  link with the object file
-  // LDOPTS = ./extern_template_before_definition_imp.o
+  // LDOPTS = extern_template_before_definition_imp.o
 #endif
#ifdef _RWSTD_NO_IMPLICIT_INCLUSION
Index: config/src/IMPLICIT_INSTANTIATION.cpp
===================================================================
--- config/src/IMPLICIT_INSTANTIATION.cpp       (revision 474707)
+++ config/src/IMPLICIT_INSTANTIATION.cpp       (working copy)
@@ -6,7 +6,7 @@
#ifndef _RWSTD_NO_EXPLICIT_INSTANTIATION
     // establish a dependency
-    // LDOPTS = ./EXPLICIT_INSTANTIATION.o
+    // LDOPTS = EXPLICIT_INSTANTIATION.o
 #endif   // _RWSTD_NO_EXPLICIT_INSTANTIATION
Index: config/src/LIB_EXCEPTIONS.cpp
===================================================================
--- config/src/LIB_EXCEPTIONS.cpp       (revision 474707)
+++ config/src/LIB_EXCEPTIONS.cpp       (working copy)
@@ -8,7 +8,7 @@
 #  ifndef _RWSTD_NO_lib_exceptions.lib
// link this compiled translation unit with the lib below
-     // LDOPTS = ./lib_exceptions.lib$(LIBSUFFIX)
+     // LDOPTS = lib_exceptions.lib$(LIBSUFFIX)
# endif // _RWSTD_NO_lib_exceptions.lib
 #endif   // 0
Index: config/src/lib_exceptions.lib.cpp
===================================================================
--- config/src/lib_exceptions.lib.cpp   (revision 474707)
+++ config/src/lib_exceptions.lib.cpp   (working copy)
@@ -1,6 +1,9 @@
#include "config.h" +#if defined (_WIN32) && defined (_DLL)
+__declspec (dllexport)
+#endif  // _WIN32 && _DLL
 int foo (int i)
 {
     if (i)
Index: config/windows/configure.wsf
===================================================================
--- config/windows/configure.wsf        (revision 474707)
+++ config/windows/configure.wsf        (working copy)
@@ -243,7 +243,7 @@
     checkHeaders();
// compile .lib.cpp s
-    if (0 == compileLibs())
+    if (0 == compileLibs(confInfo.dll))
     {
         WScript.StdErr.WriteLine(
             "You may see log here: " + logFileNameURI);
@@ -711,7 +711,7 @@
 }
//compiles all libraries (.lib.cpp files)
-function compileLibs()
+function compileLibs(shared)
 {
     var folder = fso.GetFolder(srcDir);
     var fc = new Enumerator(folder.Files);
@@ -723,7 +723,7 @@
              continue; //not a library file
         }
         var outLibName = file.Name.replace(/\.cpp/i, ".lib");
-        if (makeLibrary(srcDir + "\\" + file.Name, outLibName) != 0)
+        if (makeLibrary(srcDir + "\\" + file.Name, outLibName, shared) != 0)
         {
             WScript.StdErr.WriteLine(
"Configure: Fatal error: Failed to build library " @@ -826,10 +826,10 @@
                     (/^[^A-Z_a-z0-9]*LDOPTS\s*=\s*(\S*)\s*$/m).exec(srcText);
                 if (ldopts != null)
                 {
-                    // remove first "./" and replace $(LIBSUFFIX) with .lib
-                    // and replace .o with .obj
-                    modules += " " + ldopts[1].replace(/^\.\//, stageDir + 
"\\").
-                        replace(/\$\(LIBSUFFIX\)/, ".lib").replace(/\.o/, 
".obj");
+                    // replace $(LIBSUFFIX) with .lib and replace .o with .obj
+                    modules += " " + stageDir + "\\" +
+                        ldopts[1].replace(/\$\(LIBSUFFIX\)/, ".lib").
+                                  replace(/\.o/, ".obj");
                 }
                 var exeFile = base + ".exe";
                 var fullExeName = fileBase + ".exe";
@@ -1028,7 +1028,7 @@
 // performs compilation of the source files to the library file
 // src - string with source file names delimited by space
 // outFile - filename of the library file
-function makeLibrary(srcFiles, outFile)
+function makeLibrary(srcFiles, outFile, shared)
 {
     var ret = compileFiles(srcFiles);
     if (ret != 0)
@@ -1036,13 +1036,31 @@
var objNames = srcFiles.replace(/(?:[\S]+[/\\\\])?([^/\\\\]+\.)cpp/gi, stageDir + "/$1obj"); - - var command = AR + "/OUT:\"" + stageDir + "\\" + outFile + "\"" +
-                    joinArray(objNames.split(" "), "");
-    var message = "Making library with command \"" + command + "\"";
-    logLine(message);
- return WshShell.Run("cmd /c \"" + command +"\" >> " - + logFileName + " 2>&1", runWindowMode, true);
+
+    if (shared)
+    {
+        var libname = "\"" + stageDir + "\\" + outFile + "\"";
+        var dllname = "\"" + stageDir + "\\" + basename(outFile, "\\.lib") + 
".dll\"";
+        var command = LD + " ";
+        command += joinArray(objNames.split(" "), "");
+        command += " /Fe" + dllname + " /link /DLL " + LDFLAGS +
+                   " /IMPLIB:" + libname;
+        var message = "Making library with command \"" + command + "\"";
+        logLine(message);
+ ret = WshShell.Run("cmd /c \"" + command +"\" >> " + + logFileName + " 2>&1", runWindowMode, true);
+    }
+    else
+    {
+        var command = AR + " /OUT:\"" + stageDir + "\\" + outFile + "\"" +
+                      joinArray(objNames.split(" "), "");
+        var message = "Making library with command \"" + command + "\"";
+        logLine(message);
+ ret = WshShell.Run("cmd /c \"" + command +"\" >> " + + logFileName + " 2>&1", runWindowMode, true);
+    }
+ + return ret;
 }
// append line to the log file

Reply via email to