2014-10-16 11:53 GMT+02:00 Annick Fron <list@afceurope.com>:
Hi Eliot,

Thank you. Meanwhile I have tried to use only pointers to structs by writing some C code.

I confirm that in Pharo you can load FFI and OldAlien in the ConfigurationBrowser.
Yet it seems both FFI and Alien versions in the ConfigurationBrowser are behind the squeak repositories.��
I did not try if ��the new versions worked.

I have posted some time ago an example for X11 windows on Linux, and I never got an answer why it was failing.

actually I did answer ;) http://forum.world.st/FFI-on-Linux-again-td4780236.html
and�� you changed the argument "ourWindow" to "ourWindow xid" like I proposed. But yes,
actually this didn't help, I guess. You still get the error "bad argument" ?

My next bet would be:
Maybe we cannot mix Alien calls with (old) FFI structures (display is a externalstructure defined for FFI).


��

It was the following
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 xid.
��������������������(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.

Has anybody looked at Wayland (replacement of X11) on Linux ?

Annick

Le 15 oct. 2014 �� 19:18, Eliot Miranda <eliot.miranda@gmail.com> a ��crit :

Hi Annick,

On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron��<list@afceurope.com>��wrote:
What is the syntax to describe an external structure with an array of int of size 6 ?

I know only the syntax

fields
^#(
(param1 ���long���)
(param2 ���long���)
(param3 ���long���)
(param4 ���long���)
(param5 ���long���)
(param6 ���long���)
)

Hmm.�� Good question.�� It seems you can write

fields
"IAXCallStateEvent defineFields"
^#(
(type 'long')
(callNo 'long')
(state 'long')
(format 'long')
(vformat 'long')
(remote 'char[256]')
(remoteName 'char[256]')
(local 'char[256]')
(localContext 'char[256]')
)

But as a community we really need to document the FFI more thoroughly :-/
��

Annick



--��
best,
Eliot
Le 15 oct. 2014 �� 19:18, Eliot Miranda <eliot.miranda@gmail.com> a ��crit :

Hi Annick,

On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron <list@afceurope.com> wrote:
What is the syntax to describe an external structure with an array of int of size 6 ?

I know only the syntax

fields
^#(
(param1 ���long���)
(param2 ���long���)
(param3 ���long���)
(param4 ���long���)
(param5 ���long���)
(param6 ���long���)
)

Hmm.�� Good question.�� It seems you can write

fields
"IAXCallStateEvent defineFields"
^#(
(type 'long')
(callNo 'long')
(state 'long')
(format 'long')
(vformat 'long')
(remote 'char[256]')
(remoteName 'char[256]')
(local 'char[256]')
(localContext 'char[256]')
)

But as a community we really need to document the FFI more thoroughly :-/
��

Annick



--
best,
Eliot