[Vm-dev] Re: FFI syntax

Bert Freudenberg bert at freudenbergs.de
Fri Mar 25 11:28:26 UTC 2011


On 25.03.2011, at 12:06, Torsten Bergmann wrote:

> 1. why is it still hard to interface with the outside world
>    from Squeak (is it a problem of current FFI implementation,
>    the lack of callbacks, lack of pinned objects, ...)  
>    I doubt that it is a problem of Syntax, although I liked
>    the way it was done in Smalltalk/MT and Smallscript:

IMHO it's just lack of interest. One of the reasons people choose Squeak is its "cross-platform-ness", so adding specific platform support rarely gets larger traction. But projects like Mars show it's possible, you just really need to want it :)

> Example ST/MT:
> 
>   WINAPI MessageBox: NULL 
>     with: result asString 
>     with: 'Can you do this in another language' 
>     with: MB_YESNO | MB_ICONHAND
> 
>   Callback methods are in special method categories.
> 
> Example Smallscript/S#:
>   User32::MessageBox(NULL,'Hello','World',0) 

This has not much to do with FFI syntax itself. But *someone* created those classes. In Squeak, you would just need to create a "WINAPI" or "User32" class that provides all the functions.

That's how the OpenGL bindings work in Croquet, for example. As a user you just call the OpenGL functions, someone else took care of providing the FFI calls.

- Bert -



More information about the Vm-dev mailing list