[Pharo-users] [squeak-dev] FFI syntax
Annick Fron
list at afceurope.com
Thu Oct 16 09:53:18 UTC 2014
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.
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 at gmail.com> a écrit :
> Hi Annick,
>
> On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron <list at 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 at gmail.com> a écrit :
> Hi Annick,
>
> On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron <list at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20141016/a500fbe3/attachment-0001.htm
More information about the Squeak-dev
mailing list
|