--- a/ExternalLibraryFunction.st Tue Aug 23 09:54:28 2016 +0100
+++ b/ExternalLibraryFunction.st Thu Aug 25 11:28:17 2016 +0100
@@ -15,17 +15,19 @@
ExternalFunction subclass:#ExternalLibraryFunction
instanceVariableNames:'flags moduleName returnType argumentTypes owningClass'
- classVariableNames:'DLLPATH FLAG_VIRTUAL FLAG_NONVIRTUAL FLAG_OBJECTIVEC FLAG_ASYNC
- FLAG_UNLIMITEDSTACK FLAG_RETVAL_IS_CONST CALLTYPE_MASK
- CALLTYPE_API CALLTYPE_C CALLTYPE_OLE CALLTYPE_V8 CALLTYPE_V9
- CALLTYPE_UNIX64 DllMapping Verbose LastModuleHandleHolder
- LastModuleHandleName'
+ classVariableNames:'CALLTYPE_API CALLTYPE_C CALLTYPE_MASK CALLTYPE_OLE
+ CALLTYPE_UNIX64 CALLTYPE_V8 CALLTYPE_V9 DLLPATH DllMapping
+ FLAG_ASYNC FLAG_NONVIRTUAL FLAG_OBJECTIVEC FLAG_RETVAL_IS_CONST
+ FLAG_UNLIMITEDSTACK FLAG_VIRTUAL LastModuleHandleHolder
+ LastModuleHandleName Verbose'
poolDictionaries:''
category:'System-Support'
!
!ExternalLibraryFunction primitiveDefinitions!
%{
+#include "stxOSDefs.h"
+
#define VERBOSE
#ifdef VERBOSE
@@ -318,6 +320,23 @@
"Created: / 10-04-2012 / 12:21:45 / cg"
!
+dllMappingAt:baseLibname put:aNameOrPath
+ "allows for dll's to be replaced,
+ for example, if you want to use the mozilla sqlite dll
+ C:\Program Files\Mozilla Firefox\mozsqlite3.dll
+ for the sqlite3, execute:
+ ExternalLibraryFunction
+ dllMappingAt:'sqlite3'
+ put: 'C:\Program Files\Mozilla Firefox\mozsqlite3.dll'
+ for mingw:
+ ExternalLibraryFunction
+ dllMappingAt:'sqlite3'
+ put:'C:\mingw64\opt\bin\libsqlite3-0.dll'
+ "
+
+ self dllMapping at:baseLibname put: aNameOrPath
+!
+
dllPath
"provide a default dllPath, where external libraries are searched for"
@@ -342,7 +361,7 @@
@global(FLAG_OBJECTIVEC) = __MKSMALLINT(__EXTL_FLAG_OBJECTIVEC); // an objectiveC message send
@global(FLAG_UNLIMITEDSTACK) = __MKSMALLINT(__EXTL_FLAG_UNLIMITEDSTACK); // unlimitedstack under unix
@global(FLAG_ASYNC) = __MKSMALLINT(__EXTL_FLAG_ASYNC); // async under win32
- @global(FLAG_RETVAL_IS_CONST) = __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST); // return value is not to be registered for finalization
+ @global(FLAG_RETVAL_IS_CONST) = __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST); // retvalue is not to be registered for finalization
@global(CALLTYPE_API) = __MKSMALLINT(__EXTL_CALLTYPE_API); // WINAPI-call (win32 only)
@global(CALLTYPE_C) = __MKSMALLINT(__EXTL_CALLTYPE_C); // regular C-call (the default)
@@ -1869,6 +1888,7 @@
VOIDPTRFUNC fi = (VOIDPTRFUNC)codeAddress;
DOUBLEFUNC fd = (DOUBLEFUNC)codeAddress;
int rI[MAX_ARGS], dI[MAX_ARGS];
+ int i;
// sort the float/double args into a separate arglist and pass them AFTER the regular args.
// This is possible, because all doubles are passed in floating-pnt registers,
@@ -1886,8 +1906,8 @@
rI[nonDoubleI++] = argI;
}
}
- for (int i=doubleI; i<__numArgsIncludingThis; i++) dI[doubleI++] = 0;
- for (int i=nonDoubleI; i<__numArgsIncludingThis; i++) rI[nonDoubleI++] = 0;
+ for (i=doubleI; i<__numArgsIncludingThis; i++) dI[doubleI++] = 0;
+ for (i=nonDoubleI; i<__numArgsIncludingThis; i++) rI[nonDoubleI++] = 0;
DEBUGCODE_IF( @global(Verbose), {
printf("call %p with %d args (%d regular, %d double)\n", codeAddress, __numArgsIncludingThis,