--- a/ObjectFileLoader.st Tue Jul 24 10:10:36 2001 +0200
+++ b/ObjectFileLoader.st Tue Jul 24 18:53:48 2001 +0200
@@ -782,28 +782,28 @@
handle := self loadDynamicObject:aFileName.
handle isNil ifTrue:[
- Transcript showCR:('failed to load: ' , aFileName).
- ('ObjectFileLoader [warning]: '
- , aFileName
- , ' failed. ('
- , LinkErrorMessage
- , ')') errorPrintCR.
- ^ nil
+ Transcript showCR:('failed to load: ' , aFileName).
+ ('ObjectFileLoader [warning]: '
+ , aFileName
+ , ' failed. ('
+ , LinkErrorMessage
+ , ')') errorPrintCR.
+ ^ nil
].
list := self namesMatching:'__GLOBAL_$I*' segment:'[tT?]' in:aFileName.
list size == 1 ifTrue:[
"/ (self isCPlusPlusObject:handle) ifTrue:[
- Verbose ifTrue:[
- 'a c++ object file' infoPrintCR.
- ].
- "
- what I would like to get is the CTOR_LIST,
- and call each function.
- But dld cannot (currently) handle SET-type symbols, therefore
- we search (using nm) for all __GLOBAL_$I* syms, get their values
- and call them each
- "
+ Verbose ifTrue:[
+ 'a c++ object file' infoPrintCR.
+ ].
+ "
+ what I would like to get is the CTOR_LIST,
+ and call each function.
+ But dld cannot (currently) handle SET-type symbols, therefore
+ we search (using nm) for all __GLOBAL_$I* syms, get their values
+ and call them each
+ "
"/ list := self namesMatching:'__GLOBAL_$I*' segment:'[tT?]' in:aFileName.
"/ initAddr := self getFunction:'__CTOR_LIST__' from:handle.
@@ -811,51 +811,51 @@
"/ ('calling CTORs at:' , (initAddr printStringRadix:16)) infoPrintCR
"/ ].
- initAddr := self getFunction:list first from:handle.
- initAddr isNil ifTrue:[
- "
- try with added underscore
- "
- initAddr := self getFunction:('_' , list first) from:handle.
- ].
- (initAddr isNil and:[list first startsWith:'_']) ifTrue:[
- "
- try with removed underscore
- "
- initAddr := self getFunction:(list first copyFrom:2) from:handle.
- ].
- initAddr isNil ifTrue:[
- Verbose ifTrue:[
- ('no CTOR-func found (' , list first , ')') infoPrintCR.
- ].
- self unloadDynamicObject:aFileName.
- ^ nil
- ].
- Verbose ifTrue:[
- ('calling CTORs at:' , (initAddr printStringRadix:16)) infoPrintCR
- ].
- self callInitFunctionAt:initAddr
- specialInit:false
- forceOld:false
- interruptable:false
- argument:0
- identifyAs:nil
- returnsObject:false.
-
- Verbose ifTrue:[
- 'done with CTORs.' infoPrintNL
- ].
-
- "
- cannot create a CPlusPlus class automatically (there could be more than
- one classes in it too ...)
- "
- ^ handle
+ initAddr := self getFunction:list first from:handle.
+ initAddr isNil ifTrue:[
+ "
+ try with added underscore
+ "
+ initAddr := self getFunction:('_' , list first) from:handle.
+ ].
+ (initAddr isNil and:[list first startsWith:'_']) ifTrue:[
+ "
+ try with removed underscore
+ "
+ initAddr := self getFunction:(list first copyFrom:2) from:handle.
+ ].
+ initAddr isNil ifTrue:[
+ Verbose ifTrue:[
+ ('no CTOR-func found (' , list first , ')') infoPrintCR.
+ ].
+ self unloadDynamicObject:aFileName.
+ ^ nil
+ ].
+ Verbose ifTrue:[
+ ('calling CTORs at:' , (initAddr printStringRadix:16)) infoPrintCR
+ ].
+ self callInitFunctionAt:initAddr
+ specialInit:false
+ forceOld:false
+ interruptable:false
+ argument:0
+ identifyAs:nil
+ returnsObject:false.
+
+ Verbose ifTrue:[
+ 'done with CTORs.' infoPrintCR
+ ].
+
+ "
+ cannot create a CPlusPlus class automatically (there could be more than
+ one classes in it too ...)
+ "
+ ^ handle
].
Verbose ifTrue:[
- 'unknown object file' infoPrintNL
+ 'unknown object file' infoPrintCR
].
self unloadDynamicObject:aFileName.
^ nil
@@ -4069,6 +4069,6 @@
!ObjectFileLoader class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.218 2000-11-22 11:02:23 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.219 2001-07-24 16:53:48 stefan Exp $'
! !
ObjectFileLoader initialize!