Hi Annick,

On Mon, Sep 29, 2014 at 5:30 AM, Annick Fron <list@afceurope.com> wrote:
Hi,


I have recently made some experiments with pharo and FFI, and I have ran into problems with callbacks.
I am using linux 32 bits.
First question : when calling a dynamic�� library is it necessary that it exports all symbols ? What if symbols are noted �� U �� (undefined) ?

If you have undefined symbols in an external library, they need to be resoled by the VM or other libraries loaded in the system.�� If any are not resolved the library will fail to load.
��
2) On one of my callbacks got the message �� callback failed to own the VM �� . Have you any idea of where it comes from ?

Yes.�� This means you're trying to callback from a different thread than the VM thread. ��hat isn't supported yet.
��
3) If the callback is called�� in a different thread, is it a problem ?

Yes.

4) On Pharo I have an error on the following : is it incorrect ? It is a 64 bits problem ?
Using FFI Linux examples.

testGetOurWindowLocation
"self new testGetOurWindowLocation"

| display ourWindow aParent anX anY aWidth aHeight aBorderWidth aDepth |
display := X11Display XOpenDisplay: nil.
ourWindow := display ourWindow.
(Alien lookup: 'XGetGeometry' inLibrary: 'X11')
�� �� primFFICallResult: nil
�� �� withArguments:
�� �� �� �� {display.
�� �� �� �� ourWindow.
�� �� �� �� (aParent := Alien new: 4).
�� �� �� �� (anX := Alien new: 4).
�� �� �� �� (anY := Alien new: 4).
�� �� �� �� (aWidth := Alien new: 4).
�� �� �� �� (aHeight := Alien new: 4).
�� �� �� �� (aBorderWidth := Alien new: 4).
�� �� �� �� (aDepth := Alien new: 4)}.
(anX unsignedLongAt: 1) inspect

What's the error you get?

Annick
Le 28 sept. 2014 �� 21:44, David T. Lewis <lewis@mail.msen.com> a ��crit :

> On Sun, Sep 28, 2014 at 09:04:59AM -0400, David T. Lewis wrote:
>>
>> On Sun, Sep 28, 2014 at 11:19:30AM +0200, Nicolai Hess wrote:
>>> Who is the maintainer of the FFI-Package for
>>> Squeak and/or Pharo ?
>>> I especially interested in the FFI-Unix examples
>>> and the state on working FFI on linux for current squeak release
>>> (AFAIK it does not work with "squeak all in one" 4.5)
>>>
>>
>> The FFI package, including the FFI-Unix examples that you mention, is at
>> http://source.squeak.org/FFI.
>>
>> The primary author was Andreas Raab. Eliot Miranda is the most recent
>> contributor, and he is probably the most knowledgeable in this area.
>> Currently, the Squeak core developers (those with commit rights to Squeak
>> trunk) have commit rights to the FFI project, and can make updates as needed.
>>
>> The FFI examples for Unix work with the old FFI plugin, which is still
>> present in the interpreter VM. The active development of Squeak FFI is
>> taking place in Cog, and I'm not sure if the old FFI examples work with
>> the newer plugins (which would be present in the Squeak all-in-one).
>> The FFI plugin in the interpreter VM (i.e. trunk VMMaker) needs to be
>> updated, and presumably the FFI examples may need some updates as well.
>
> A small but important correction: For the old plugin (currently in the
> interpreter VM), FFI works only for a 32-bit VM. It also works for a 64-bit
> VM, but only if the patches in http://bugs.squeak.org/view.php?id=7237 have
> been applied (in other words, if you compiled it yourself and included
> those patches).
>
> This is mainly of historical interest, although it is possible that some
> of the 64-bit patches will prove helpful for the newer FFI plugin. But
> the emphasis now should be on Eliot's more recent FFI work.
>
> Dave
>
>





--
best,
Eliot