[Pharo-project] Status of Alien FFI

Stéphane Ducasse stephane.ducasse at inria.fr
Wed Sep 16 14:54:12 EDT 2009

I will let eliot comment on that because I'm alien newbie.
We cleaned it so that people can use it but
>> it is correct that alien touches the parser?
>> The declarations are not pragmas compliant.
> Yes -- there's a hack in there that allows an error code variable to  
> be passed in the <primitive> pragma where otherwise the parser would  
> expect a literal.
>> Of course your suggestion makes sense.
>> When marcus is back in europe I will check the status of the
>> new handwritten parser because it would be good to use it.
> Thanks Stef. I've got some other ideas for Alien; is this list the  
> best place to discuss those? Specifically:
> * AlienLibrary shouldn't do its cleanup at shutdown, it should do it  
> at image startup instead. That way a simple image save won't  
> invalidate all of my external references.
> * I'm creating a partial Alien library for GemStone so that I can  
> use the CairoGraphics package in both Pharo and GLASS.

what is the cairoPackage?
For pharo 1.1 I would like to see Rome cleaned and loadable/integrated  
in pharo.

> 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.
> * Similarly, I'd like an API on AlienLibrary that distinguishes  
> between integers and longs. In the CairoGraphics package I've added  
> some methods to this effect:
> 	 CRLibrary
> 		int: 'cairo_surface_write_to_png' 		with: handle 		with: string  
> address
> 	or
> 	patternHandle := CRLibrary 		pointer: 'cairo_pop_group' 		with:  
> handle.
> I like the way it reads. And even though on IA32 they both use the  
> same 4-byte primitive, on x86-64 I could have pointers return an 8- 
> byte Alien and ints return a 4-byte primitive.
> * Same story with the basic data accessors like (un)signedLongAt: --  
> I'd want to add something like (un)signedIntAt et. al.
> Yes, I realize that some of this is overkill for IA32 only, but on  
> the other hand I think a couple of these intention-revealing changes  
> would make Alien client code prettier.
> Sorry to be so wordy. I'd be glad to do all of the Smalltalk-level  
> coding on this -- much of it is done already in my image -- but I  
> thought I'd better ask the maintainer(s) first and this list is the  
> best forum I've found for Alien issues.
> --
> Ken Treis
> Miriam Technologies, Inc.
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

More information about the Pharo-dev mailing list