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â) ) Annick
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
2014-10-15 19:18 GMT+02:00 Eliot Miranda <eliot.miranda@gmail.com>:
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 :-/
+1 I can not even find up to date information on how to *install* current working FFI. Aren't there any "alive" projects build on FFI (old or Alien-FFI). It would help to see more real-life examples.
Annick
-- best, Eliot
Hi, The old ODBC/FFI has quite some bindings in ODBCLibrary class that may be of some help. To load FFI (taken from http://pharo.gemtalksystems.com/book/PharoTools/FFI/ ): Gofer new squeaksource: 'MetacelloRepository'; package: 'ConfigurationOfFFI'; load. (Smalltalk at: #ConfigurationOfFFI) project lastVersion load and ODBC: Gofer new squeaksource: 'ODBC'; package: 'ConfigurationOfODBC'; load. Both works very well with Pharo 3 (didn't try yet in Pharo 4) Regards Alain Le 15/10/2014 22:59, Nicolai Hess a écrit :
2014-10-15 19:18 GMT+02:00 Eliot Miranda <eliot.miranda@gmail.com <mailto:eliot.miranda@gmail.com>>:
Hi Annick,
On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron <list@afceurope.com <mailto: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 :-/
+1 I can not even find up to date information on how to *install* current working FFI. Aren't there any "alive" projects build on FFI (old or Alien-FFI). It would help to see more real-life examples.
Annick
-- best, Eliot
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@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
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
participants (4)
-
Alain Rastoul -
Annick Fron -
Eliot Miranda -
Nicolai Hess