AW: Re: ODBC and Mac OS X
John M McIntosh
johnmci at smalltalkconsulting.com
Tue Oct 16 19:37:44 UTC 2007
We have lots of FFI in Sophie.
The key to it is
(a) being able to find the module that is in the FFI call. Or a
derived name which is based on the module name.
(b) being able to find the module in some path that the Squeak VM
will search in.
For the os-x carbon VM
See SqueakPluginsBuiltInOrLocalOnly
http://www.smalltalkconsulting.com/html/squeakinfoplist.html
Once the module is found we find the procedure name, again based on
the information in the Smalltalk method. So for the example below we
expect to find NavCreateNewFolderDialog in Carbon.framework which is
in /System/Library/Frameworks a place where we look automatically for
frameworks.
Of course the input parms and return value must match expectations,
otherwise you crash the VM, or get an error coecering variables
between Smalltalk objects and C types.
apiNavCreateNewFolderDialog: aMacNavDialogCreationOptions eventProc:
aEventProc client: data dialogRef: aNavDialogRef
<cdecl: long
'NavCreateNewFolderDialog' ( MacNavDialogCreationOptions* long long
MacNavDialogRef*) module:'Carbon.framework'>
^ self externalCallFailed
"OSStatus NavCreateNewFolderDialog (
const NavDialogCreationOptions * inOptions,
NavEventUPP inEventProc,
void * inClientData,
NavDialogRef * outDialog
);"
The usual problems you run into is finding and loading the module.
The os-x carbon VM has a SqueakDebug info.plist value you can set to
1 to help debug this issue.
After finding the module the next issue likely is coding a proper
parm list and then giving it the correct objects.
save image often, cross fingers...
On Oct 16, 2007, at 12:20 PM, Petr Fischer wrote:
> Yes. It works... and reads data from Firebird SQL.
--
========================================================================
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
========================================================================
===
More information about the Squeak-dev
mailing list
|