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 <[hidden email]> wrote: What is the syntax to describe an external structure with an array of int of size 6 ? 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 :-/
best, Eliot
|
2014-10-15 19:18 GMT+02:00 Eliot Miranda <[hidden email]>:
+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.
|
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 <[hidden email] > <mailto:[hidden email]>>: > > Hi Annick, > > On Wed, Oct 15, 2014 at 7:57 AM, Annick Fron <[hidden email] > <mailto:[hidden email]>> 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 > > > > > |
In reply to this post by Eliot Miranda-2
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 <[hidden email]> a écrit :
Le 15 oct. 2014 à 19:18, Eliot Miranda <[hidden email]> a écrit :
|
2014-10-16 11:53 GMT+02:00 Annick Fron <[hidden email]>:
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).
|
Free forum by Nabble | Edit this page |