show linker error messages (win32)
authorClaus Gittinger <cg@exept.de>
Wed, 30 Sep 1998 19:10:16 +0200
changeset 780 294b6775c8ab
parent 779 9301641eafbc
child 781 7de50bbbf651
show linker error messages (win32) setup loaded libs (win32).
ObjFLoader.st
ObjectFileLoader.st
--- a/ObjFLoader.st	Wed Sep 30 17:32:18 1998 +0200
+++ b/ObjFLoader.st	Wed Sep 30 19:10:16 1998 +0200
@@ -279,100 +279,104 @@
     |systemType|
 
     OperatingSystem isMSDOSlike ifTrue:[
-	"/ default setup for msc
-	OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'tlink32'.
-		LinkCommand := 'ilink32'.
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ..\libbc\librun.lib'.
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
-	    ].
-	] ifFalse:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'link'
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
-	    ].
-	].
+        "/ default setup for msc
+        OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'tlink32'.
+                LinkCommand := 'ilink32'.
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ..\libbc\librun.lib'.
+                LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
+            ].
+        ] ifFalse:[
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'link'
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
+            ].
+        ].
     ].
 
     MySymbolTable isNil ifTrue:[
-	Verbose := false.
-	NextHandleID := 1.
-	ObjectMemory addDependent:self.
-
-"/      OperatingSystem isMSDOSlike ifTrue:[
-"/          "/ ... we'll see
-"/      ].
-
-	OperatingSystem isUNIXlike ifTrue:[
-	    systemType := OperatingSystem getOSType.
-
-	    "/ name of object file, where initial symbol table is found
-	    "/ not req'd for all architectures.
-
-	    MySymbolTable := 'stx'.
-
-	    "/ default set of libraries to be considered when
-	    "/ unresolved symbols are encountered during the load.
-	    "/ Only req'd for linux and sunos non-ELF systems.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    SearchedLibraries := #().
-
-	    (systemType = 'linux' 
-	    or:[systemType = 'sunos']) ifTrue:[
-		'/usr/lib/libc.a' asFilename isReadable ifTrue:[
-		    SearchedLibraries := #('/usr/lib/libc.a')
-		] ifFalse:[
-		    '/lib/libc.a' asFilename isReadable ifTrue:[
-			SearchedLibraries := #('/lib/libc.a')
-		    ]
-		]
-	    ].
-
-	    "/ default libraryPath where shared objects are searched for
-	    "/ when a dynamic library is loaded without an explicit path.
-
-	    LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-	    LoadLibraryPath isNil ifTrue:[
-		LoadLibraryPath := #('.'
-				     'lib'
-				     '/usr/local/smalltalk/lib'
-				     '/usr/local/lib'
-				     '/usr/lib'
-				     '/lib'
-				    ) asOrderedCollection.
-	    ].
-
-	    "/ default libraryPath where shared objects are expected
-	    "/ when a sharedObject load requires other objects to be loaded.
-	    "/ Only req'd for aix.
-	    "/ For more compatibility with ELF systems, look for a shell variable
-	    "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    systemType = 'aix' ifTrue:[
-		LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-		LibPath isNil ifTrue:[
-		    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
-		]
-	    ].
-	]
+        Verbose := false.
+        NextHandleID := 1.
+        ObjectMemory addDependent:self.
+
+        OperatingSystem isMSDOSlike ifTrue:[
+            SearchedLibraries := #(
+                                    'import32.lib'
+                                  ).
+        ].
+
+        OperatingSystem isUNIXlike ifTrue:[
+            systemType := OperatingSystem getOSType.
+
+            "/ name of object file, where initial symbol table is found
+            "/ not req'd for all architectures.
+
+            MySymbolTable := 'stx'.
+
+            "/ default set of libraries to be considered when
+            "/ unresolved symbols are encountered during the load.
+            "/ Only req'd for linux and sunos non-ELF systems.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            SearchedLibraries := #().
+
+            (systemType = 'linux' 
+            or:[systemType = 'sunos']) ifTrue:[
+                '/usr/lib/libc.a' asFilename isReadable ifTrue:[
+                    SearchedLibraries := #('/usr/lib/libc.a')
+                ] ifFalse:[
+                    '/lib/libc.a' asFilename isReadable ifTrue:[
+                        SearchedLibraries := #('/lib/libc.a')
+                    ]
+                ]
+            ].
+
+            "/ default libraryPath where shared objects are searched for
+            "/ when a dynamic library is loaded without an explicit path.
+
+            LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+            LoadLibraryPath isNil ifTrue:[
+                LoadLibraryPath := #('.'
+                                     'lib'
+                                     '/usr/local/smalltalk/lib'
+                                     '/usr/local/lib'
+                                     '/usr/lib'
+                                     '/lib'
+                                    ) asOrderedCollection.
+            ].
+
+            "/ default libraryPath where shared objects are expected
+            "/ when a sharedObject load requires other objects to be loaded.
+            "/ Only req'd for aix.
+            "/ For more compatibility with ELF systems, look for a shell variable
+            "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            systemType = 'aix' ifTrue:[
+                LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+                LibPath isNil ifTrue:[
+                    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
+                ]
+            ].
+        ]
     ]
 
     "
      ObjectFileLoader initialize
     "
 
-    "Modified: / 4.9.1998 / 01:59:42 / cg"
+    "Modified: / 30.9.1998 / 17:28:24 / cg"
 !
 
 lastError
-    ^ LastError
+    ^ LastError ? 'unknown error'
+
+    "Modified: / 30.9.1998 / 17:21:23 / cg"
 !
 
 libPath
@@ -2301,90 +2305,86 @@
      Other systems may require more ..."
 
     |osType oFileName soFileName expFileName librunExpFileName
-     needSharedObject ld ldArg expFile ok|
+     needSharedObject ld ldArg expFile ok outfile output|
 
     osType := OperatingSystem getOSType.
 
     osType = 'win32' ifTrue:[
-	self activityNotification:'create def file'.
-
-	"/ create an exports file.
-	expFileName := '.\' , baseFileName , '.def'.
-
-	expFile := expFileName asFilename writeStream.
-	expFile notNil ifTrue:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' __' , baseFileName , '_Init'.
-	    ] ifFalse:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'CODE EXECUTE READ SHARED'.
-		expFile nextPutLine:'DATA READ WRITE'.
-		expFile nextPutLine:'SECTIONS'.
-		expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
-		expFile nextPutLine:' INITDATA READ WRITE'.
-		expFile nextPutLine:' RODATA READ SHARED'.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' _' , baseFileName , '_Init'.
-		expFile nextPutLine:'IMPORTS'.
-	    ].
-	    expFile close.
-	].
-
-	self activityNotification:'generating shared object'.
-
-	"
-	 link it to a dll with 'LINK'
-	"
-"/        librunExpFileName := 'librun.exp'.
-"/        librunExpFileName asFilename exists ifFalse:[
-"/            librunExpFileName := 'lib\librun.exp'.
-"/            librunExpFileName asFilename exists ifFalse:[
-"/                librunExpFileName := 'include\librun.exp'.
-"/                librunExpFileName asFilename exists ifFalse:[
-"/                    librunExpFileName := '..\librun\librun.exp'.
-"/                    librunExpFileName asFilename exists ifFalse:[
-"/self warn:('missing exports file: ''librun.exp'' - cannot link').
-"/"/                        LastError := 'missing exports file: ''librun.exp'' - cannot link'.
-"/"/                        ^ nil
-"/                    ].
-"/                ].
-"/            ].
-"/        ].
-
-	LinkArgs isNil ifTrue:[
-	    ld := LinkCommand , ' ' , baseFileName , '.obj'.
-	    ld := ld
-	       , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
-	       , ' /OUT:' , baseFileName , '.dll '
-	       , ' /DEF:' , baseFileName , '.def'.
-	] ifFalse:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
-		ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
-		ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib import32.lib stxc32i.lib,,'.
-	    ] ifFalse:[
-		self halt.
-	    ]
-	].
-	ok := OperatingSystem executeCommand:ld.
-	(baseFileName , '.tds') asFilename delete.
-	(baseFileName , '.ilc') asFilename delete.
-	(baseFileName , '.ild') asFilename delete.
-	(baseFileName , '.ilf') asFilename delete.
-	(baseFileName , '.ils') asFilename delete.
-	(baseFileName , '.lib') asFilename delete.
-	(baseFileName , '.map') asFilename delete.
-	(baseFileName , '.def') asFilename delete.
-	(baseFileName , '.obj') asFilename delete.
-
-	ok ifFalse:[
-	    "/ self halt.
-	    ^nil
-	].
-	oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
-	^ oFileName
+        self activityNotification:'create def file'.
+
+        "/ create a .def file.
+        expFileName := '.\' , baseFileName , '.def'.
+
+        expFile := expFileName asFilename writeStream.
+        expFile notNil ifTrue:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'SEGMENTS'.
+                expFile nextPutLine:'    INITCODE PRELOAD SHARED'.
+"/                expFile nextPutLine:'    INITDATA READ WRITE'.
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' __' , baseFileName , '_Init'.
+            ] ifFalse:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'CODE EXECUTE READ SHARED'.
+                expFile nextPutLine:'DATA READ WRITE'.
+                expFile nextPutLine:'SECTIONS'.
+                expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
+                expFile nextPutLine:' INITDATA READ WRITE'.
+                expFile nextPutLine:' RODATA READ SHARED'.
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' _' , baseFileName , '_Init'.
+                expFile nextPutLine:'IMPORTS'.
+            ].
+            expFile close.
+        ].
+
+        self activityNotification:'generating shared object'.
+
+        LinkArgs isNil ifTrue:[
+            ld := LinkCommand , ' ' , baseFileName , '.obj'.
+            ld := ld
+               , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
+               , ' /OUT:' , baseFileName , '.dll '
+               , ' /DEF:' , baseFileName , '.def'.
+        ] ifFalse:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
+                ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
+                ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib '.
+                ld := ld , (SearchedLibraries asStringCollection asStringWith: $ ).
+                ld := ld , ' stxc32i.lib,,'.
+            ] ifFalse:[
+                self halt.
+            ]
+        ].
+
+        outfile := (baseFileName , '.out').
+        ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
+
+        ok ifFalse:[
+            output := (baseFileName , '.out') asFilename contents asString.
+            Transcript showCR:output; endEntry.
+        ].
+
+        (baseFileName , '.out') asFilename delete.
+        (baseFileName , '.tds') asFilename delete.
+        (baseFileName , '.ilc') asFilename delete.
+        (baseFileName , '.ild') asFilename delete.
+        (baseFileName , '.ilf') asFilename delete.
+        (baseFileName , '.ils') asFilename delete.
+        (baseFileName , '.lib') asFilename delete.
+        (baseFileName , '.map') asFilename delete.
+        (baseFileName , '.def') asFilename delete.
+        (baseFileName , '.obj') asFilename delete.
+
+        ok ifFalse:[
+            "/ self halt.
+            LastError := output.
+            ^ nil
+        ].
+        oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
+        ^ oFileName
     ].
 
     "/ UNIX systems
@@ -2393,108 +2393,108 @@
     needSharedObject := false.
 
     osType = 'irix' ifTrue:[
-	"
-	 link it to a shared object with 'ld -shared'
-	"
-	needSharedObject := true.
-	ldArg := '-shared'.
+        "
+         link it to a shared object with 'ld -shared'
+        "
+        needSharedObject := true.
+        ldArg := '-shared'.
     ].
 
     osType = 'sys5_4' ifTrue:[
-	"
-	 link it to a shared object with 'ld -G'
-	"
-	needSharedObject := true.
-	ldArg := '-G'.
+        "
+         link it to a shared object with 'ld -G'
+        "
+        needSharedObject := true.
+        ldArg := '-G'.
     ].
 
     osType = 'osf' ifTrue:[
-	"
-	 link it to a shared object with 'ld -shared'
-	"
-	needSharedObject := true.
-	ldArg := '-shared'.
+        "
+         link it to a shared object with 'ld -shared'
+        "
+        needSharedObject := true.
+        ldArg := '-shared'.
     ].
 
     osType = 'linux' ifTrue:[
-	ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
-	    "
-	     link it to a shared object with 'ld -shared'
-	    "
-	    needSharedObject := true.
-	    ldArg := '-shared'.
-	]
+        ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
+            "
+             link it to a shared object with 'ld -shared'
+            "
+            needSharedObject := true.
+            ldArg := '-shared'.
+        ]
     ].
 
     osType = 'solaris' ifTrue:[
-	"
-	 link it to a shared object with 'ld -G -B dynamic'
-	"
-	needSharedObject := true.
-	ldArg := '-G -B dynamic'.
+        "
+         link it to a shared object with 'ld -G -B dynamic'
+        "
+        needSharedObject := true.
+        ldArg := '-G -B dynamic'.
     ].
 
     osType = 'hpux' ifTrue:[
-	"
-	 link it to a shared object with 'ld -b -B immediate'
-	"
-	needSharedObject := true.
-	ldArg := '-b -B immediate'.
+        "
+         link it to a shared object with 'ld -b -B immediate'
+        "
+        needSharedObject := true.
+        ldArg := '-b -B immediate'.
     ].
 
     osType = 'aix' ifTrue:[
-	self activityNotification:'create export file'.
-
-	"/ create an exports file.
-	expFileName := './' , baseFileName , '.exp'.
-
-	expFile := expFileName asFilename writeStream.
-	expFile notNil ifTrue:[
-	    expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
-	    expFile cr.
-	    expFile nextPutAll:'_' , baseFileName , '_Init'.
-	    expFile close.
-	].
-
-	self activityNotification:'generating shared object'.
-
-	"
-	 link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
-	"
-	needSharedObject := true.
-	ld := 'cc'.
-	librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
-	librunExpFileName isNil ifTrue:[
-	    LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
-	    ^ nil
-	].
-
-	ldArg := '-bI:' , librunExpFileName ,
-		' -bE:' , baseFileName , '.exp' ,
-		' -bM:SRE -e _' , baseFileName , '_Init'.
+        self activityNotification:'create export file'.
+
+        "/ create an exports file.
+        expFileName := './' , baseFileName , '.exp'.
+
+        expFile := expFileName asFilename writeStream.
+        expFile notNil ifTrue:[
+            expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
+            expFile cr.
+            expFile nextPutAll:'_' , baseFileName , '_Init'.
+            expFile close.
+        ].
+
+        self activityNotification:'generating shared object'.
+
+        "
+         link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
+        "
+        needSharedObject := true.
+        ld := 'cc'.
+        librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
+        librunExpFileName isNil ifTrue:[
+            LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
+            ^ nil
+        ].
+
+        ldArg := '-bI:' , librunExpFileName ,
+                ' -bE:' , baseFileName , '.exp' ,
+                ' -bM:SRE -e _' , baseFileName , '_Init'.
     ].
 
     oFileName := './' , baseFileName , (self objectFileExtension).
     needSharedObject ifTrue:[
-	self activityNotification:'generating shared object'.
-
-	soFileName := './' , baseFileName , (self sharedLibraryExtension). 
-	OperatingSystem removeFile:soFileName.
-	Verbose ifTrue:[
-	    'linking with:' infoPrintCR.
-	    '   ' infoPrint.
-	    (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
-	].         
-	OperatingSystem executeCommand:
-	    ld , ' ' , ldArg , ' ', 
-	    (SearchedLibraries asStringCollection asStringWith: $ ), 
-	    ' -o ' , soFileName , ' ' , oFileName.
-
-	OperatingSystem removeFile:oFileName.
-	expFileName notNil ifTrue:[
-	    OperatingSystem removeFile:expFileName
-	].
-	^ soFileName. 
+        self activityNotification:'generating shared object'.
+
+        soFileName := './' , baseFileName , (self sharedLibraryExtension). 
+        OperatingSystem removeFile:soFileName.
+        Verbose ifTrue:[
+            'linking with:' infoPrintCR.
+            '   ' infoPrint.
+            (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
+        ].         
+        OperatingSystem executeCommand:
+            ld , ' ' , ldArg , ' ', 
+            (SearchedLibraries asStringCollection asStringWith: $ ), 
+            ' -o ' , soFileName , ' ' , oFileName.
+
+        OperatingSystem removeFile:oFileName.
+        expFileName notNil ifTrue:[
+            OperatingSystem removeFile:expFileName
+        ].
+        ^ soFileName. 
     ].
 
     "
@@ -2502,7 +2502,7 @@
     "
     ^ oFileName
 
-    "Modified: / 4.9.1998 / 15:25:54 / cg"
+    "Modified: / 30.9.1998 / 18:13:46 / cg"
 ! !
 
 !ObjectFileLoader class methodsFor:'lowlevel object loading'!
@@ -3708,6 +3708,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.178 1998-09-30 15:32:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/Attic/ObjFLoader.st,v 1.179 1998-09-30 17:10:16 cg Exp $'
 ! !
 ObjectFileLoader initialize!
--- a/ObjectFileLoader.st	Wed Sep 30 17:32:18 1998 +0200
+++ b/ObjectFileLoader.st	Wed Sep 30 19:10:16 1998 +0200
@@ -279,100 +279,104 @@
     |systemType|
 
     OperatingSystem isMSDOSlike ifTrue:[
-	"/ default setup for msc
-	OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'tlink32'.
-		LinkCommand := 'ilink32'.
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ..\libbc\librun.lib'.
-		LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
-	    ].
-	] ifFalse:[
-	    LinkCommand isNil ifTrue:[
-		LinkCommand := 'link'
-	    ].
-	    LinkArgs isNil ifTrue:[
-		LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
-	    ].
-	].
+        "/ default setup for msc
+        OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'tlink32'.
+                LinkCommand := 'ilink32'.
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ..\libbc\librun.lib'.
+                LinkArgs := '-L..\libbc -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'.
+            ].
+        ] ifFalse:[
+            LinkCommand isNil ifTrue:[
+                LinkCommand := 'link'
+            ].
+            LinkArgs isNil ifTrue:[
+                LinkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def'
+            ].
+        ].
     ].
 
     MySymbolTable isNil ifTrue:[
-	Verbose := false.
-	NextHandleID := 1.
-	ObjectMemory addDependent:self.
-
-"/      OperatingSystem isMSDOSlike ifTrue:[
-"/          "/ ... we'll see
-"/      ].
-
-	OperatingSystem isUNIXlike ifTrue:[
-	    systemType := OperatingSystem getOSType.
-
-	    "/ name of object file, where initial symbol table is found
-	    "/ not req'd for all architectures.
-
-	    MySymbolTable := 'stx'.
-
-	    "/ default set of libraries to be considered when
-	    "/ unresolved symbols are encountered during the load.
-	    "/ Only req'd for linux and sunos non-ELF systems.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    SearchedLibraries := #().
-
-	    (systemType = 'linux' 
-	    or:[systemType = 'sunos']) ifTrue:[
-		'/usr/lib/libc.a' asFilename isReadable ifTrue:[
-		    SearchedLibraries := #('/usr/lib/libc.a')
-		] ifFalse:[
-		    '/lib/libc.a' asFilename isReadable ifTrue:[
-			SearchedLibraries := #('/lib/libc.a')
-		    ]
-		]
-	    ].
-
-	    "/ default libraryPath where shared objects are searched for
-	    "/ when a dynamic library is loaded without an explicit path.
-
-	    LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-	    LoadLibraryPath isNil ifTrue:[
-		LoadLibraryPath := #('.'
-				     'lib'
-				     '/usr/local/smalltalk/lib'
-				     '/usr/local/lib'
-				     '/usr/lib'
-				     '/lib'
-				    ) asOrderedCollection.
-	    ].
-
-	    "/ default libraryPath where shared objects are expected
-	    "/ when a sharedObject load requires other objects to be loaded.
-	    "/ Only req'd for aix.
-	    "/ For more compatibility with ELF systems, look for a shell variable
-	    "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
-	    "/ Can (should) be set in the smalltalk.rc file.
-
-	    systemType = 'aix' ifTrue:[
-		LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
-		LibPath isNil ifTrue:[
-		    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
-		]
-	    ].
-	]
+        Verbose := false.
+        NextHandleID := 1.
+        ObjectMemory addDependent:self.
+
+        OperatingSystem isMSDOSlike ifTrue:[
+            SearchedLibraries := #(
+                                    'import32.lib'
+                                  ).
+        ].
+
+        OperatingSystem isUNIXlike ifTrue:[
+            systemType := OperatingSystem getOSType.
+
+            "/ name of object file, where initial symbol table is found
+            "/ not req'd for all architectures.
+
+            MySymbolTable := 'stx'.
+
+            "/ default set of libraries to be considered when
+            "/ unresolved symbols are encountered during the load.
+            "/ Only req'd for linux and sunos non-ELF systems.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            SearchedLibraries := #().
+
+            (systemType = 'linux' 
+            or:[systemType = 'sunos']) ifTrue:[
+                '/usr/lib/libc.a' asFilename isReadable ifTrue:[
+                    SearchedLibraries := #('/usr/lib/libc.a')
+                ] ifFalse:[
+                    '/lib/libc.a' asFilename isReadable ifTrue:[
+                        SearchedLibraries := #('/lib/libc.a')
+                    ]
+                ]
+            ].
+
+            "/ default libraryPath where shared objects are searched for
+            "/ when a dynamic library is loaded without an explicit path.
+
+            LoadLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+            LoadLibraryPath isNil ifTrue:[
+                LoadLibraryPath := #('.'
+                                     'lib'
+                                     '/usr/local/smalltalk/lib'
+                                     '/usr/local/lib'
+                                     '/usr/lib'
+                                     '/lib'
+                                    ) asOrderedCollection.
+            ].
+
+            "/ default libraryPath where shared objects are expected
+            "/ when a sharedObject load requires other objects to be loaded.
+            "/ Only req'd for aix.
+            "/ For more compatibility with ELF systems, look for a shell variable
+            "/ named LD_LIBRARY_PATH, and - if present - take that instead if a default.
+            "/ Can (should) be set in the smalltalk.rc file.
+
+            systemType = 'aix' ifTrue:[
+                LibPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'.
+                LibPath isNil ifTrue:[
+                    LibPath := '.:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'.
+                ]
+            ].
+        ]
     ]
 
     "
      ObjectFileLoader initialize
     "
 
-    "Modified: / 4.9.1998 / 01:59:42 / cg"
+    "Modified: / 30.9.1998 / 17:28:24 / cg"
 !
 
 lastError
-    ^ LastError
+    ^ LastError ? 'unknown error'
+
+    "Modified: / 30.9.1998 / 17:21:23 / cg"
 !
 
 libPath
@@ -2301,90 +2305,86 @@
      Other systems may require more ..."
 
     |osType oFileName soFileName expFileName librunExpFileName
-     needSharedObject ld ldArg expFile ok|
+     needSharedObject ld ldArg expFile ok outfile output|
 
     osType := OperatingSystem getOSType.
 
     osType = 'win32' ifTrue:[
-	self activityNotification:'create def file'.
-
-	"/ create an exports file.
-	expFileName := '.\' , baseFileName , '.def'.
-
-	expFile := expFileName asFilename writeStream.
-	expFile notNil ifTrue:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' __' , baseFileName , '_Init'.
-	    ] ifFalse:[
-		expFile nextPutLine:'LIBRARY ' , baseFileName.
-		expFile nextPutLine:'CODE EXECUTE READ SHARED'.
-		expFile nextPutLine:'DATA READ WRITE'.
-		expFile nextPutLine:'SECTIONS'.
-		expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
-		expFile nextPutLine:' INITDATA READ WRITE'.
-		expFile nextPutLine:' RODATA READ SHARED'.
-		expFile nextPutLine:'EXPORTS'.
-		expFile nextPutLine:' _' , baseFileName , '_Init'.
-		expFile nextPutLine:'IMPORTS'.
-	    ].
-	    expFile close.
-	].
-
-	self activityNotification:'generating shared object'.
-
-	"
-	 link it to a dll with 'LINK'
-	"
-"/        librunExpFileName := 'librun.exp'.
-"/        librunExpFileName asFilename exists ifFalse:[
-"/            librunExpFileName := 'lib\librun.exp'.
-"/            librunExpFileName asFilename exists ifFalse:[
-"/                librunExpFileName := 'include\librun.exp'.
-"/                librunExpFileName asFilename exists ifFalse:[
-"/                    librunExpFileName := '..\librun\librun.exp'.
-"/                    librunExpFileName asFilename exists ifFalse:[
-"/self warn:('missing exports file: ''librun.exp'' - cannot link').
-"/"/                        LastError := 'missing exports file: ''librun.exp'' - cannot link'.
-"/"/                        ^ nil
-"/                    ].
-"/                ].
-"/            ].
-"/        ].
-
-	LinkArgs isNil ifTrue:[
-	    ld := LinkCommand , ' ' , baseFileName , '.obj'.
-	    ld := ld
-	       , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
-	       , ' /OUT:' , baseFileName , '.dll '
-	       , ' /DEF:' , baseFileName , '.def'.
-	] ifFalse:[
-	    OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
-		ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
-		ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
-		ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib import32.lib stxc32i.lib,,'.
-	    ] ifFalse:[
-		self halt.
-	    ]
-	].
-	ok := OperatingSystem executeCommand:ld.
-	(baseFileName , '.tds') asFilename delete.
-	(baseFileName , '.ilc') asFilename delete.
-	(baseFileName , '.ild') asFilename delete.
-	(baseFileName , '.ilf') asFilename delete.
-	(baseFileName , '.ils') asFilename delete.
-	(baseFileName , '.lib') asFilename delete.
-	(baseFileName , '.map') asFilename delete.
-	(baseFileName , '.def') asFilename delete.
-	(baseFileName , '.obj') asFilename delete.
-
-	ok ifFalse:[
-	    "/ self halt.
-	    ^nil
-	].
-	oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
-	^ oFileName
+        self activityNotification:'create def file'.
+
+        "/ create a .def file.
+        expFileName := '.\' , baseFileName , '.def'.
+
+        expFile := expFileName asFilename writeStream.
+        expFile notNil ifTrue:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'SEGMENTS'.
+                expFile nextPutLine:'    INITCODE PRELOAD SHARED'.
+"/                expFile nextPutLine:'    INITDATA READ WRITE'.
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' __' , baseFileName , '_Init'.
+            ] ifFalse:[
+                expFile nextPutLine:'LIBRARY ' , baseFileName.
+                expFile nextPutLine:'CODE EXECUTE READ SHARED'.
+                expFile nextPutLine:'DATA READ WRITE'.
+                expFile nextPutLine:'SECTIONS'.
+                expFile nextPutLine:' INITCODE READ EXECUTE SHARED'.
+                expFile nextPutLine:' INITDATA READ WRITE'.
+                expFile nextPutLine:' RODATA READ SHARED'.
+                expFile nextPutLine:'EXPORTS'.
+                expFile nextPutLine:' _' , baseFileName , '_Init'.
+                expFile nextPutLine:'IMPORTS'.
+            ].
+            expFile close.
+        ].
+
+        self activityNotification:'generating shared object'.
+
+        LinkArgs isNil ifTrue:[
+            ld := LinkCommand , ' ' , baseFileName , '.obj'.
+            ld := ld
+               , ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL'
+               , ' /OUT:' , baseFileName , '.dll '
+               , ' /DEF:' , baseFileName , '.def'.
+        ] ifFalse:[
+            OperatingSystem getCCDefine ='__BORLANDC__' ifTrue:[
+                ld := LinkCommand , ' ' , (LinkArgs bindWith:baseFileName).
+                ld := ld , ' c0d32.obj ' , baseFileName , '.obj '.
+                ld := ld , ',' , baseFileName , '.dll,,..\libbc\librun.lib '.
+                ld := ld , (SearchedLibraries asStringCollection asStringWith: $ ).
+                ld := ld , ' stxc32i.lib,,'.
+            ] ifFalse:[
+                self halt.
+            ]
+        ].
+
+        outfile := (baseFileName , '.out').
+        ok := OperatingSystem executeCommand:(ld , ' >' , outfile).
+
+        ok ifFalse:[
+            output := (baseFileName , '.out') asFilename contents asString.
+            Transcript showCR:output; endEntry.
+        ].
+
+        (baseFileName , '.out') asFilename delete.
+        (baseFileName , '.tds') asFilename delete.
+        (baseFileName , '.ilc') asFilename delete.
+        (baseFileName , '.ild') asFilename delete.
+        (baseFileName , '.ilf') asFilename delete.
+        (baseFileName , '.ils') asFilename delete.
+        (baseFileName , '.lib') asFilename delete.
+        (baseFileName , '.map') asFilename delete.
+        (baseFileName , '.def') asFilename delete.
+        (baseFileName , '.obj') asFilename delete.
+
+        ok ifFalse:[
+            "/ self halt.
+            LastError := output.
+            ^ nil
+        ].
+        oFileName := (Filename currentDirectory construct:(baseFileName , self sharedLibraryExtension)) name.
+        ^ oFileName
     ].
 
     "/ UNIX systems
@@ -2393,108 +2393,108 @@
     needSharedObject := false.
 
     osType = 'irix' ifTrue:[
-	"
-	 link it to a shared object with 'ld -shared'
-	"
-	needSharedObject := true.
-	ldArg := '-shared'.
+        "
+         link it to a shared object with 'ld -shared'
+        "
+        needSharedObject := true.
+        ldArg := '-shared'.
     ].
 
     osType = 'sys5_4' ifTrue:[
-	"
-	 link it to a shared object with 'ld -G'
-	"
-	needSharedObject := true.
-	ldArg := '-G'.
+        "
+         link it to a shared object with 'ld -G'
+        "
+        needSharedObject := true.
+        ldArg := '-G'.
     ].
 
     osType = 'osf' ifTrue:[
-	"
-	 link it to a shared object with 'ld -shared'
-	"
-	needSharedObject := true.
-	ldArg := '-shared'.
+        "
+         link it to a shared object with 'ld -shared'
+        "
+        needSharedObject := true.
+        ldArg := '-shared'.
     ].
 
     osType = 'linux' ifTrue:[
-	ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
-	    "
-	     link it to a shared object with 'ld -shared'
-	    "
-	    needSharedObject := true.
-	    ldArg := '-shared'.
-	]
+        ObjectFileLoader loadableBinaryObjectFormat == #elf ifTrue:[
+            "
+             link it to a shared object with 'ld -shared'
+            "
+            needSharedObject := true.
+            ldArg := '-shared'.
+        ]
     ].
 
     osType = 'solaris' ifTrue:[
-	"
-	 link it to a shared object with 'ld -G -B dynamic'
-	"
-	needSharedObject := true.
-	ldArg := '-G -B dynamic'.
+        "
+         link it to a shared object with 'ld -G -B dynamic'
+        "
+        needSharedObject := true.
+        ldArg := '-G -B dynamic'.
     ].
 
     osType = 'hpux' ifTrue:[
-	"
-	 link it to a shared object with 'ld -b -B immediate'
-	"
-	needSharedObject := true.
-	ldArg := '-b -B immediate'.
+        "
+         link it to a shared object with 'ld -b -B immediate'
+        "
+        needSharedObject := true.
+        ldArg := '-b -B immediate'.
     ].
 
     osType = 'aix' ifTrue:[
-	self activityNotification:'create export file'.
-
-	"/ create an exports file.
-	expFileName := './' , baseFileName , '.exp'.
-
-	expFile := expFileName asFilename writeStream.
-	expFile notNil ifTrue:[
-	    expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
-	    expFile cr.
-	    expFile nextPutAll:'_' , baseFileName , '_Init'.
-	    expFile close.
-	].
-
-	self activityNotification:'generating shared object'.
-
-	"
-	 link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
-	"
-	needSharedObject := true.
-	ld := 'cc'.
-	librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
-	librunExpFileName isNil ifTrue:[
-	    LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
-	    ^ nil
-	].
-
-	ldArg := '-bI:' , librunExpFileName ,
-		' -bE:' , baseFileName , '.exp' ,
-		' -bM:SRE -e _' , baseFileName , '_Init'.
+        self activityNotification:'create export file'.
+
+        "/ create an exports file.
+        expFileName := './' , baseFileName , '.exp'.
+
+        expFile := expFileName asFilename writeStream.
+        expFile notNil ifTrue:[
+            expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension).
+            expFile cr.
+            expFile nextPutAll:'_' , baseFileName , '_Init'.
+            expFile close.
+        ].
+
+        self activityNotification:'generating shared object'.
+
+        "
+         link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE'
+        "
+        needSharedObject := true.
+        ld := 'cc'.
+        librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'.
+        librunExpFileName isNil ifTrue:[
+            LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'.
+            ^ nil
+        ].
+
+        ldArg := '-bI:' , librunExpFileName ,
+                ' -bE:' , baseFileName , '.exp' ,
+                ' -bM:SRE -e _' , baseFileName , '_Init'.
     ].
 
     oFileName := './' , baseFileName , (self objectFileExtension).
     needSharedObject ifTrue:[
-	self activityNotification:'generating shared object'.
-
-	soFileName := './' , baseFileName , (self sharedLibraryExtension). 
-	OperatingSystem removeFile:soFileName.
-	Verbose ifTrue:[
-	    'linking with:' infoPrintCR.
-	    '   ' infoPrint.
-	    (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
-	].         
-	OperatingSystem executeCommand:
-	    ld , ' ' , ldArg , ' ', 
-	    (SearchedLibraries asStringCollection asStringWith: $ ), 
-	    ' -o ' , soFileName , ' ' , oFileName.
-
-	OperatingSystem removeFile:oFileName.
-	expFileName notNil ifTrue:[
-	    OperatingSystem removeFile:expFileName
-	].
-	^ soFileName. 
+        self activityNotification:'generating shared object'.
+
+        soFileName := './' , baseFileName , (self sharedLibraryExtension). 
+        OperatingSystem removeFile:soFileName.
+        Verbose ifTrue:[
+            'linking with:' infoPrintCR.
+            '   ' infoPrint.
+            (ld , ' ' , ldArg , ' -o ' , soFileName , ' ' , oFileName) infoPrintCR.
+        ].         
+        OperatingSystem executeCommand:
+            ld , ' ' , ldArg , ' ', 
+            (SearchedLibraries asStringCollection asStringWith: $ ), 
+            ' -o ' , soFileName , ' ' , oFileName.
+
+        OperatingSystem removeFile:oFileName.
+        expFileName notNil ifTrue:[
+            OperatingSystem removeFile:expFileName
+        ].
+        ^ soFileName. 
     ].
 
     "
@@ -2502,7 +2502,7 @@
     "
     ^ oFileName
 
-    "Modified: / 4.9.1998 / 15:25:54 / cg"
+    "Modified: / 30.9.1998 / 18:13:46 / cg"
 ! !
 
 !ObjectFileLoader class methodsFor:'lowlevel object loading'!
@@ -3708,6 +3708,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.178 1998-09-30 15:32:18 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.179 1998-09-30 17:10:16 cg Exp $'
 ! !
 ObjectFileLoader initialize!