#BUGFIX
authorClaus Gittinger <cg@exept.de>
Mon, 28 Mar 2016 03:16:34 +0200
changeset 19483 0ac4cc951e32
parent 19482 9067334aa4b7
child 19484 ac46be87b8f2
#BUGFIX class: ExternalLibraryFunction changed: #linkToModule
ExternalLibraryFunction.st
--- a/ExternalLibraryFunction.st	Mon Mar 28 03:12:06 2016 +0200
+++ b/ExternalLibraryFunction.st	Mon Mar 28 03:16:34 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2004 by eXept Software AG
 	      All Rights Reserved
@@ -140,7 +138,7 @@
   Synchronous vs. Asynchronous calls:
 
     by default, foreign function calls are synchronous, effectively blocking the whole ST/X system
-    (that is by purpose,´because most C-code is not prepared for being interrupted, and also, normal
+    (that is by purpose,´because most C-code is not prepared for being interrupted, and also, normal
      code is not prepared for a garbage collector to move objects around, while another C thread might
      access the data...).
     Therefore, the following will block all ST/X activity for 10 seconds
@@ -649,45 +647,43 @@
     |handle moduleNameUsed functionName|
 
     name isNumber ifTrue:[
-	self isCPPFunction ifTrue:[
-	    "/ no need to load a dll.
-	    ^ self
-	]
+        self isCPPFunction ifTrue:[
+            "/ no need to load a dll.
+            ^ self
+        ]
     ].
 
     "/ in some other smalltalks, there is no moduleName in the ffi-spec;
     "/ instead, the class provides the libraryName...
     (moduleNameUsed := moduleName) isNil ifTrue:[
-	owningClass isNil ifTrue:[
-	    self error:'Missing moduleName'.
-	].
-	moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol.
+        owningClass isNil ifTrue:[
+            self error:'Missing moduleName'.
+        ].
+        moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol.
     ].
     moduleHandle isNil ifTrue:[
-	"/ speedup. in 95% of all calls, the same moduleName is resolved here
-	(LastModuleHandleHolder isNil
-	or:[ (handle := LastModuleHandleHolder at:1) isNil
-	or:[ LastModuleHandleName ~= moduleNameUsed ]]) ifTrue:[
+        "/ speedup. in 95% of all calls, the same moduleName is resolved here
+        (LastModuleHandleHolder isNil
+        or:[ (handle := LastModuleHandleHolder at:1) isNil
+        or:[ LastModuleHandleName ~= moduleNameUsed ]]) ifTrue:[
 
-	    handle := self loadLibrary:moduleNameUsed.
-	    handle isNil ifTrue:[
-		self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed).
-	    ].
-	    LastModuleHandleHolder := WeakArray with:handle.
-	    LastModuleHandleName := moduleNameUsed.
-	].
-	moduleHandle := handle.
+            handle := self loadLibrary:moduleNameUsed.
+            handle isNil ifTrue:[
+                self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed).
+            ].
+            LastModuleHandleHolder := WeakArray with:handle.
+            LastModuleHandleName := moduleNameUsed.
+        ].
+        moduleHandle := handle.
     ].
     name isNumber ifFalse:[
-	functionName := name.
-	(moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
-	    functionName := ('_', functionName) asSymbol.
-
-	    (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
-		moduleHandle := nil.
-		self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
-	    ].
-	].
+        functionName := name.
+        (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
+            (moduleHandle getFunctionAddress:('_', functionName) into:self) isNil ifTrue:[
+                moduleHandle := nil.
+                self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
+            ].
+        ].
     ].
 
     "Modified: / 10-04-2012 / 12:12:44 / cg"