[VM][OS X] FFI plugin 1.1.0b1

Alain Fischer alain.fischer at bluewin.ch
Mon Mar 4 22:58:58 UTC 2002


Hi Marcel,


Le Lundi 4 mars 2002, à 12:07 , Marcel Weiher a écrit :

>
> On Sunday, March 3, 2002, at 10:07 PM, Alain Fischer wrote:
>
>> After a lot of hour trying to call the functions of my own framework 
>> trough the FFI plugin,
>> I have finally figured out that this work only if my framework is 
>> installed in:
>> 	/System/Library/Frameworks
>> Which is not nice since Apple is not recommanding to change anything 
>> in this location.
>
> Yes, installing anything /System is not a good idea.
>
>> What would be nice is if the framework location could be anywere in:
>> 	(the application bundle of the VM) (the best solution)
>> 	~/Library/Frameworks
>> 	/Library/Frameworks
>> 	/Network/Library/Frameworks
>
> With CocoaSqueak, you can just add the framework in question to the 
> CocoaSqueak application and recompile/relink.  This is probably the 
> smoothest option, resulting in a custom VM with your precise 
> functionality.  CocoaSqueak was designed specifically to make this sort 
> of thing easy, by splitting off most of the grunt Squeak-VM stuff into 
> frameworks.  This split turns the app itself into a tiny skeleton that 
> is easy to customize.

Yes, the CocoaSqueak VM is the first I have tried to call the methods of 
Foundation.framework with some sucess,
but after some test, I needed to enhance the behavior of your 
ObjcBridge. I then tried to build your VM (3.2b) without
success with too many errors and warnings after a few hours trying to 
fix the code that stop the build process.
Then I switched to the Carbon VM to see if I was able to call 
Objective-C code through a wrapper framework called
through the FFI plugin.

Peraps you could help me to figure out what to do to successfuly build 
your VM.

> Another option is to load the framework into your address-space 
> dynamically, for example using NSBundle, which may be accessed through 
> the Objective-C bridge.

Loading a bundle or a framework dynamically is my prefered option, but 
this was a lot more easy with Cocoa than Carbon.
With OCUnit, we load dynamically the code to test with a small helper 
tool and there is only a few line of code.
I must recognize that my knowledge is better with Cocoa than Carbon, but 
it seem to me that there is a lot of good thing
like NSPathUtilities that I don't find with Carbon.

>> I have tried to found where the framework module is loaded in the VM 
>> code when called
>> by the FFI plugin but found noting. The only part which seem to run 
>> the external function
>> is a bunch of incomprehensible assembler code for me.
>
> Whatever you do, the framework first has to be linked into your VM, 
> either dynamically or 'statically'.

Yes, I know, but before the mail of John, I wasn't sure were and how the 
framework was loaded, now I understand
a little better how the VM do that.

>> I need some advice from the VM guru. Will it be simple to modify the 
>> FFI plugin to find
>> framework in the correct location or to develop a specific plugin ?
>
> The easiest option would probably be creating a custom VM.

I don't understand this, for me, it was one of the hardest option. Could 
you develop your mind on this ?

>
> Marcel
>
>
> --
> Marcel Weiher				Metaobject Software Technologies
> marcel at metaobject.com		www.metaobject.com
> Metaprogramming for the Graphic Arts.   HOM, IDEAs, MetaAd etc.
>
>
>

Thanks for your explanation.
Have a nice day.
Alain




More information about the Squeak-dev mailing list