Johan Brichau wrote:
On 16 Sep 2009, at 20:37, Ken Treis wrote:
* I'm creating a partial Alien library for GemStone so that I can use the CairoGraphics package in both Pharo and GLASS. But on x86-64, there there's a size difference between a pointer/long and an integer. It'd be nice to have some more explicit APIs on Alien, so I could say "Alien newCInteger" or "Alien newCLong" and have the platform return me the proper size Alien. Even without the platform size differences, it seems awkward to use "Alien newC: 4" everywhere I want an integer, "Alien newC: 8" where I want a double, etc.
Exactly.
It becomes worse once you start having structs and nested structs or structs with pointers to structs ;-)
I'm using Alien as the FFI to port JavaConnect from Visualworks to Pharo/Squeak. As you say, it is a pain to work at such a low-level compared to the DLLCC in VW. I am planning to do some work on creating a higher-level interface for it such that we can operate it as you mention, including the correct bytesizes for all platforms.
At the moment, I'm mostly focusing on getting the port to work right before I start creating an interface on top of the current Alien interface.
Something to keep in mind is the need for a straightforward way of going the other way: John Mcintosh's port of the Squeak VM to iPhone implies that the same thing could be done in other Lua-ish situations, allowing people to use smalltalk syntax for game scripting. With the right libraries for an IDE, I would think squeak could be very attractive to at least some people in place of/in addition to using Lua. Lawson