Hi Mattieu,

Damien Pollet and I wrote a quick-and-dirty binding for GST a few years back in 
an afternoon.  I'm not sure if he tidied it up - I got bored with it because we 
now have a native Smalltalk implementation for Étoilé so interfacing with a 
slower Smalltalk was less interesting to me, but I'd be happy to help anyone 
wanting to work on the bridge.

To open frameworks, the best thing to do is use the NSBundle functionality - 
this works on both GNUstep and OS X.  In LanguageKit, there is code for loading 
a list of frameworks that is specified in a .plist file accompanying a set of 
Smalltalk files - it's MIT licensed, so feel free to steal it.  If copyright 
assignment is an issue, then I'd be happy for my GNUstep FSF copyright 
assignment to cover this code, so I can commit anything that you want to steal 
to GNUstep svn somewhere and you can then import it into other GNU projects.

More comments inline...


On 28 Feb 2011, at 15:16, Mathieu Suen wrote:

> Hi,
> 
> I am trying to write a gnustep/Etoile binding  for gnu-smalltalk.
> I don't know if this ML is the right one so just let me know.
> 
> Here is the thing:
> 
> When writing the binding for Cocoa on OSX I can dynamically load framework 
> with 
> libtool:
> 
> lt_dlopenext ("Foundation.framework/Foundation");

You can just use dlopen() directly if you want to open the library, although 
this may not register things with Foundation correctly.  The best way of doing 
it is to provide the .framework path to [NSBundle bundleWithPath:].  

You can find a wrapper around this here:

http://svn.gna.org/viewcvs/etoile/trunk/Etoile/Languages/LanguageKit/LKCompiler.m?revision=6793&view=markup

Look for the loadFramework() function - this loads a framework by name, and 
works on OS X and GNUstep, searching for the framework in the standard 
locations.

> ...
> 
> I also need the Objective-C runtime for method like objc_getClass.
> Currently when I load the objc library it load  /usr/lib/libobjc.so.2, I 
> guess 
> this is not the right one.
> Using gdb it shows that the symbol does not exist.

This function is provided by the GNUstep Objective-C runtime, by the 
ObjectiveC2 compatibility framework in GNUstep Base, and by the GCC Objective-C 
runtime shipped with 4.6.

libobjc.so.2 looks like you are using a very old version of the GCC Objective-C 
runtime, so this function should be being provided by GNUstep base, unless you 
are using a version more than a year old.

David

-- Sent from my IBM 1620
_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à