ObjectFileLoader.st
changeset 472 bc81318662b9
parent 471 508fa84cb122
child 474 bf2345df4093
--- a/ObjectFileLoader.st	Wed Jan 08 18:26:21 1997 +0100
+++ b/ObjectFileLoader.st	Wed Jan 08 18:29:47 1997 +0100
@@ -791,6 +791,9 @@
     "load an object file (.o-file) into the image; 
      the class name is not needed (multiple definitions may be in the file).
      This may be either a smalltalk object or a C-object file.
+     The object files init function (if any) is called, and the module
+     is unloaded if it returns failure (use lowLevel load, to load a file
+     without automatic initialization).
      Return nil on error, an objectFile handle if ok."
 
     |handle initAddr className initNames didInit info status
@@ -945,7 +948,7 @@
     ].
     ^ handle
 
-    "Modified: 8.1.1997 / 18:25:08 / cg"
+    "Modified: 8.1.1997 / 18:28:12 / cg"
 !
 
 unloadAllObsoleteObjectFiles
@@ -1932,26 +1935,30 @@
 loadDynamicObject:pathName
     "load an object-file (load/map into my address space).
      Return a non-nil handle if ok, nil otherwise.
-     No bindings are done - only a pure load is performed.
+     No bindings or automatic initializations are done 
+     - only a pure (low-level) load is performed.
+     For class-files or C-objects to be loaded with this method,
+     it is your responsibility to fetch any init-functions and
+     call them as appropriate.
      This function is not supported on all architectures.
     "
 
     |handle buffer|
 
     Verbose ifTrue:[
-	('loadDynamic: ' , pathName , ' ...') infoPrintNL
+        ('loadDynamic: ' , pathName , ' ...') infoPrintNL
     ].
 
     "/ already loaded ?
 
     LoadedObjects notNil ifTrue:[
-	handle := LoadedObjects at:pathName ifAbsent:nil.
-	handle notNil ifTrue:[
-	    Verbose ifTrue:[
-		('... ' , pathName , ' already loaded.') infoPrintNL.
-	    ].
-	    ^ handle
-	].
+        handle := LoadedObjects at:pathName ifAbsent:nil.
+        handle notNil ifTrue:[
+            Verbose ifTrue:[
+                ('... ' , pathName , ' already loaded.') infoPrintNL.
+            ].
+            ^ handle
+        ].
     ].
 
     "/
@@ -1965,19 +1972,19 @@
 
     buffer := self primLoadDynamicObject:pathName into:buffer.
     buffer isNil ifTrue:[
-	LastError == #notImplemented ifTrue:[
-	    Verbose ifTrue:[
-		'no dynamic load facility or load failed.' infoPrintNL.
-	    ].
-	].
-	buffer isNil ifTrue:[
-	    LastError == #linkError ifTrue:[
-		LinkErrorMessage notNil ifTrue:[
-		    Transcript showCR:'Load error:' , LinkErrorMessage
-		].    
-	    ].    
-	    ^ nil
-	]
+        LastError == #notImplemented ifTrue:[
+            Verbose ifTrue:[
+                'no dynamic load facility or load failed.' infoPrintNL.
+            ].
+        ].
+        buffer isNil ifTrue:[
+            LastError == #linkError ifTrue:[
+                LinkErrorMessage notNil ifTrue:[
+                    Transcript showCR:'Load error:' , LinkErrorMessage
+                ].    
+            ].    
+            ^ nil
+        ]
     ].
 
     "
@@ -1990,13 +1997,13 @@
     handle moduleID:(buffer at:4).
 
     LoadedObjects isNil ifTrue:[
-	LoadedObjects := Dictionary new.
+        LoadedObjects := Dictionary new.
     ].
     LoadedObjects at:pathName put:handle.
     Smalltalk flushCachedClasses.
 
     Verbose ifTrue:[
-	('loadDynamic ok; handle is: ' , handle printString) infoPrintNL.
+        ('loadDynamic ok; handle is: ' , handle printString) infoPrintNL.
     ].
 
     ^ handle
@@ -2017,7 +2024,7 @@
      ObjectFileLoader getFunction:'__TetrisBlock_Init' from:handle
     "
 
-    "Modified: 18.5.1996 / 15:43:56 / cg"
+    "Modified: 8.1.1997 / 18:29:18 / cg"
 !
 
 loadModulesFromListOfUndefined:list
@@ -2951,6 +2958,6 @@
 !ObjectFileLoader class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.126 1997-01-08 17:26:21 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.127 1997-01-08 17:29:47 cg Exp $'
 ! !
 ObjectFileLoader initialize!