BCompiler.st
changeset 125 5c5f62d4d89d
parent 124 33f03c2a028a
child 126 aca2139a3526
--- a/BCompiler.st	Sun Sep 17 19:59:05 1995 +0200
+++ b/BCompiler.st	Mon Oct 23 17:58:15 1995 +0100
@@ -27,7 +27,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	     All Rights Reserved
 
-$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.41 1995-09-17 17:58:42 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.42 1995-10-23 16:57:48 cg Exp $
 '!
 
 !ByteCodeCompiler class methodsFor:'documentation'!
@@ -48,7 +48,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.41 1995-09-17 17:58:42 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Attic/BCompiler.st,v 1.42 1995-10-23 16:57:48 cg Exp $
 "
 !
 
@@ -462,6 +462,7 @@
 
     "
      Compiler stcCompilationIncludes:'-I/usr/local/include -I../../include'
+     Compiler stcCompilationIncludes:(Compiler stcCompilationIncludes , ' -I../../libxt')
     "
 !
 
@@ -1611,8 +1612,9 @@
 
     |stFileName stream handle address flags command oFileName soFileName 
      initName newMethod ok status className sep class stcPath 
-     errorStream errorMessages|
+     errorStream errorMessages eMsg|
 
+    ObjectFileLoader isNil ifTrue:[^ #Error].
     STCCompilation == #never ifTrue:[^ #Error].
     (stcPath := self class incrementalStcPath) isNil ifTrue:[
 	self parseError:'no stc compiler available - cannot create machine code' position:1.
@@ -1659,8 +1661,7 @@
     stream nextPut:sep.
     stream cr.
 
-    stream nextPutAll:'"{ Line: 0 }"'; cr.
-    stream nextPutAll:aString.
+    stream nextPutAll:'"{ Line: 0 }"'; cr; nextPutAll:aString.
     stream nextPut:sep; space; nextPut:sep.
 
     stream close.
@@ -1720,10 +1721,11 @@
 	    errorMessages isNil ifTrue:[
 		errorMessages := ''
 	    ].
-	    self parseError:('STC error during compilation:\',errorMessages)withCRs position:1.
+	    eMsg := ('STC error during compilation:\',errorMessages) withCRs.
 	] ifFalse:[
-	    self parseError:'oops, no STC - cannot create machine code' position:1.
+	    eMsg := 'oops, no STC - cannot create machine code'
 	].
+	self parseError:eMsg position:1.
 	OperatingSystem removeFile:stFileName.
 	^ #Error
     ].
@@ -1745,7 +1747,7 @@
 	OperatingSystem removeFile:oFileName.
 	oFileName := soFileName. 
     ] ifFalse:[
-	OperatingSystem getOSType = 'sys5.4' ifTrue:[
+	OperatingSystem getOSType = 'sys5_4' ifTrue:[
 	    "
 	     link it to a shared object
 	    "
@@ -1757,8 +1759,6 @@
 	].
     ].
 
-"/ ObjectFileLoader verbose:true.
-
     "
      load the objectfile
     "
@@ -1775,9 +1775,18 @@
     address isNil ifTrue:[
 	address := ObjectFileLoader getFunction:'_' , initName , '_Init' from:handle.
 	address isNil ifTrue:[
+	    (ObjectFileLoader getListOfUndefinedSymbolsFrom:handle) size > 0 ifTrue:[
+		ObjectFileLoader listUndefinedSymbolsIn:handle.
+		eMsg := 'undefined symbols in primitive code'.
+	    ] ifFalse:[
+		eMsg := initName , '_Init() lookup failed'
+	    ].
+
+	    ObjectFileLoader unloadDynamicObject:handle.
+
 	    OperatingSystem removeFile:stFileName.
 	    OperatingSystem removeFile:oFileName.
-	    self parseError:initName , '_Init() lookup failed - cannot create machine code' position:1.
+	    self parseError:(eMsg , ' - cannot create machine code') position:1.
 	    ^ #Error
 	]
     ].