pluggable primitive(S)?

Dana Anthony daanth at
Thu May 13 15:58:23 UTC 1999

I am suggesting this with zero actual experience writing pluggable
primitives, but, couldnt you
write just ONE pluggable primitive like so:

JasmineDLL methods

call: functionName with: argumentArray 

^self call: functionName with: argumentArray size: argumentArray size

call: functionName with: argumentArray size: argumentCount

"This primitive calls any of the functions in the Jasmine DLL.  Put the
arguments into
the argumentArray in the correct order"

<primitive syntax I don't know>

Then the C primitive would have code something like:

void * jasmineDLL_genericPrimitive (char * fname, void **argV, int argc)
{  if argc = 0 then return (void) & jasmineDLL_zeroArgFunction(fname);
   if argc = 1 then return (void) & jasmineDLL_oneArgFunction(fname,
..... etc to the maximum number of arguments in the library functions you
are stubbing to

void * jasmineDLL_twoArgFunction (char * fname, void **argV)
{   if strcmp(fname, "firstfunction") then return (void) &
firstfunction((int) *argv[0], (char *) argv[1]);
..... etc for each differnt 2 variable function

course with all the casting and stuff it'd be slower but it would work? 
the idea I mean,
not the exact code :)

Lex Spoon wrote:
> Linking in system libraries is one thing pluggable primitives are really good at.  You have to write a separate C "plug" for each function you want to link out of the library, though, which can be a pain.
> Lex
> "Eric Ulevik" <eau at> wrote:
> > From: Roxie Rochat <rrochat at>
> > >I need to connect to a Jasmine database from Squeak.
> > >Jasmine doesn't have a Smalltalk API yet, but I have located
> > >an ODBC wrapper.  Has anyone written or is working on
> > >an ODBC interface for Squeak?  Or are there better alternatives?
> >
> > The Jasmine C-API is a lot simpler and better than ODBC. This is a DLL
> > interface.
> >
> > The problem then becomes how to get from Squeak to C methods in a DLL..
> >
> > One idea, which may be sensible depending upon your application, is to write
> > a separate Windows executable that makes all the Jasmine calls, and talks
> > TCP/IP to Squeak.
> >
> > Regards,
> >
> > Eric Ulevik

Dana Lynne Goldblatt Anthony
Internet Publications Technology at SAS Institute
World Headquarters Cary, NC, USA

More information about the Squeak-dev mailing list