On Wed, 5 Jul 2000, Jecel Assumpcao Jr wrote:
My impression is that FFI is for calling functions in external libraries. Can it also be used for stuff like this that is in that standard library?
Yes. If you don't supply a module name the function gets looked up in the executable itself, which includes the standard lib. For the system() call, that would be:
system: aString <cdecl: long 'system' (char *)> ^ExternalFunction externalCallFailed
Now, the recent external primitive rework has broken this. To look up an internal function, the program module itself must be loaded via dlopen(NULL,...) - something that has vanished from the sources.
I've attached a diff for both sqUnixExternalPrims.c and the omni-platform sqNamedPrims.c.
THIS AFFECTS OTHER PLATFORMS!
Now, ioLoadModule() is called once with an empty module name to load the intrinsics. The resulting handle is stored in squeakModule->handle. Someone should make this work for other platforms ;^)
-- Bert