Help with external plugins
cottonsqueak at earthlink.net
Thu Jan 30 04:51:01 UTC 2003
I'm trying to figure out how to write an external plugin (The specific
application is OggVorbis, no promises).
I'm having a hard time with it. I have reviewed the information on the Swiki
and stuff in Squeak, but coul dstill use some help.
I am basically trying to 'wrap' high-level function calls in a library that
do all the hard work. I think an external plugin is needed because:
1) at nearly 2 megs, the static libraries would nearly triple the size of
2) FFI, while much easier, wouldn't be portable.
Here's an example of what I'm trying to do.
For a C function residing in 'vorbisfile.dll' having the following
int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
I create this method in my plugin class (using the specification system, I
assume thats the best way to go):
primOvOpen: file oggVorbisFile: vf initial: initial long: ibytes
|rcvr size |
self primitive: 'primOvOpen'
The following questions come up:
The c-land things like FILE and the struct OggVorbis_File need to be
allocated and released in c, right? I would guess that you do it in another
primitive method (to ease the error handling), pass a pointer back to
Smalltalk, and have an additional primitive method to release them when
explicitly asked or the holding object gets GC'd.
Whats an 'oop', in the context of passing parameters to primitives?
How do I make the actual function call to the DLL ?
I didn't think this would be as hard as it has turned out.. Thanks much for
More information about the Squeak-dev