--- a/ExternalLibraryFunction.st Wed Nov 04 17:44:06 2009 +0100
+++ b/ExternalLibraryFunction.st Thu Nov 05 11:37:15 2009 +0100
@@ -514,35 +514,35 @@
|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
+ ]
].
(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:[
- handle := self loadLibrary:moduleNameUsed.
- handle isNil ifTrue:[
- self error:('Cannot load module: "%1"' bindWith: moduleNameUsed).
- ].
- moduleHandle := handle.
+ handle := self loadLibrary:moduleNameUsed.
+ handle isNil ifTrue:[
+ self error:('Cannot load module: "%1"' bindWith: moduleNameUsed).
+ ].
+ moduleHandle := handle.
].
name isNumber ifFalse:[
- functionName := name.
- (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
- functionName := ('_', functionName) asSymbol.
+ 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.
- ].
- ].
+ (moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[
+ moduleHandle := nil.
+ self error:'Missing function: ', name, ' in module: ', moduleNameUsed.
+ ].
+ ].
].
"Modified: / 01-08-2006 / 16:24:14 / cg"
@@ -555,20 +555,20 @@
nameString := filename name.
filename exists ifTrue:[
- handle := ObjectFileLoader loadDynamicObject:(filename pathName).
- handle notNil ifTrue:[^ handle ].
+ handle := ObjectFileLoader loadDynamicObject:(filename pathName).
+ handle notNil ifTrue:[^ handle ].
].
filename isAbsolute ifFalse:[
- self class dllPath do:[:eachDirectory |
- handle := ObjectFileLoader
- loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
- handle notNil ifTrue:[^ handle ].
- ].
+ self class dllPath do:[:eachDirectory |
+ handle := ObjectFileLoader
+ loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName.
+ handle notNil ifTrue:[^ handle ].
+ ].
].
filename suffix isEmpty ifTrue:[
- "/ try again with the OS-specific dll-extension
- ^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix)
+ "/ try again with the OS-specific dll-extension
+ ^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix)
].
^ nil
@@ -576,8 +576,8 @@
prepareInvoke
(moduleHandle isNil or:[self hasCode not]) ifTrue:[
- self linkToModule.
- self adjustTypes.
+ self linkToModule.
+ self adjustTypes.
].
! !
@@ -585,9 +585,9 @@
ffiTypeSymbolForType:aType
"map type to one of the ffi-supported ones:
- sint8, sint16, sint32, sint64
- uint8, uint16, uint32, uint64
- bool void handle
+ sint8, sint16, sint32, sint64
+ uint8, uint16, uint32, uint64
+ bool void pointer handle
"
aType == #sint8 ifTrue:[^ aType ].
@@ -609,8 +609,9 @@
aType == #int16 ifTrue:[^ #sint16 ].
aType == #int32 ifTrue:[^ #sint32 ].
aType == #int64 ifTrue:[^ #sint64 ].
- aType == #voidPointer ifTrue:[^ #pointer ].
- aType == #uint8Pointer ifTrue:[^ #pointer ].
+
+ aType == #voidPointer ifTrue:[^ #pointer ].
+ aType == #uint8Pointer ifTrue:[^ #pointer ].
aType == #voidPointerPointer ifTrue:[^ #pointer ].
aType == #short ifTrue:[^ #sint16 ].
@@ -628,6 +629,8 @@
aType == #sdword ifTrue:[^ #sint32 ].
aType == #word ifTrue:[^ #uint16 ].
aType == #sword ifTrue:[^ #sint16 ].
+ aType == #longLong ifTrue:[^ #sint64 ].
+ aType == #ulongLong ifTrue:[^ #uint64 ].
aType == #handle ifTrue:[^ #pointer ].
aType == #lpstr ifTrue:[^ #charPointer ].
aType == #hresult ifTrue:[^ #uint32 ].
@@ -640,14 +643,14 @@
aType == #unsigned ifTrue:[^ #uint ].
(aType isString or:[aType isSymbol]) ifFalse:[
- CType isNil ifTrue:[
- self error:'unknown type'.
- ].
- ^ aType typeSymbol.
+ CType isNil ifTrue:[
+ self error:'unknown type'.
+ ].
+ ^ aType typeSymbol.
].
(aType endsWith:'Pointer') ifTrue:[
- ^ #pointer.
+ ^ #pointer.
].
^ aType
@@ -1395,11 +1398,11 @@
!ExternalLibraryFunction class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.68 2009-11-04 16:44:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.69 2009-11-05 10:37:15 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.68 2009-11-04 16:44:06 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.69 2009-11-05 10:37:15 cg Exp $'
! !
ExternalLibraryFunction initialize!