[Pharo-project] Fwd: Status of Alien FFI
Begin forwarded message:
From: Eliot Miranda <eliot.miranda@gmail.com> Date: September 19, 2009 12:44:43 AM CEDT To: Stéphane Ducasse <stephane.ducasse@inria.fr> Subject: Re: [Pharo-project] Status of Alien FFI
On Fri, Sep 18, 2009 at 12:29 AM, Stéphane Ducasse <stephane.ducasse@inria.fr> wrote:
Begin forwarded message:
From: Martin McClure <martin@hand2mouse.com> Date: September 18, 2009 12:57:43 AM CEDT To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] Status of Alien FFI Reply-To: Pharo-project@lists.gforge.inria.fr
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.
I'd like to work toward a standard FFI that works across many Smalltalk dialects. Right now, it's too hard to port packages such as CairoGraphics that call large external libraries. A year ago, I tried porting CairoGraphics from VW to an early version of GemStone's FFI. It was way too much work.
And GemStone/S 64-bit 3.0, due out probably sometime next year, will have a completely new FFI. It's probably not too late to influence the design for better compatibility.
Is Alien, possibly with some changes, a suitable cross-platform cross-dialect FFI standard? Or is it too low-level?
I think it is OK as a substrate for data representation but not for calls. It is a little low-level but also a lot simpler and easier to use than CDatum et al. I'm attaching the doc and you ca make up your own mind.
Regards,
-Martin
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (1)
-
Stéphane Ducasse