2014-09-28 22:04 GMT+02:00 Nicolai Hess <nicolaihess@web.de>:
Thank you David,
Thank you Eliot

2014-09-28 21:24 GMT+02:00 Eliot Miranda <eliot.miranda@gmail.com>:

Hi Nicolai,

On Sep 28, 2014, at 2:19 AM, Nicolai Hess <nicolaihess@web.de> wrote:

> Who is the maintainer of the FFI-Package for
> Squeak and/or Pharo ?

I guess I'm the de facto maintainer because I'm the one who has changed things most recently, reimplementing the FFI plugin via the ThreadedFFIPlugin.


> 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)

Can you give me a reproducible case?  I'd this with a Cog,Stack or Interpreter VM?  Which specific things fail and how?

Image
-----
/home/nicolai/Downloads/Squeak-4.5-All-in-One.app/Contents/Resources/Squeak4.5-13680.image
Squeak4.5
latest update: #13680
Current Change Set: Unnamed1
Image format 6505 (32 bit)

Virtual Machine
---------------
/home/nicolai/Downloads/Squeak-4.5-All-in-One.app/Contents/Linux-i686/lib/squeak/4.0-2776/squeak
Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.331]
Unix built on Aug 22 2013 10:35:37 Compiler: 4.1.2 20080704 (Red Hat 4.1.2-48)
platform sources revision VM: r2776 http://www.squeakvm.org/svn/squeak/branches/Cog Plugins: r2545 http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
CoInterpreter VMMaker.oscog-eem.331 uuid: 37d2e4b0-2f37-4e2d-8313-c63637785e59 Aug 22 2013
StackToRegisterMappingCogit VMMaker.oscog-eem.333 uuid: 84da9cb8-7f30-4cb7-b4fb-239a11f63b54 Aug 22 2013

Load
Name: FFI-Pools-eem.3
Name: FFI-Kernel-eem.26
Name: FFI-Tests-djm.7

Run FFI-Test -> 32 run, 24 passes, 0 expected failures, 0 failures, 8 errors, 0 unexpected passes

Load
Name: FFI-Unix-mtf.4
 
run X11Display class>>#coloredRectangles
-> Error: Could not coerse arguments

Load newer cogvm
Virtual Machine
---------------
/media/Programs/squeak/Squeak-4.5-All-in-One.app/coglinux/lib/squeak/4.0-2987/squeak
Croquet Closure Cog VM [CoInterpreter VMMaker.oscog-eem.746]
Unix built on Jun 11 2014 14:59:18 Compiler: 4.1.2 20080704 (Red Hat 4.1.2-48)
platform sources revision VM: r2987 http://www.squeakvm.org/svn/squeak/branches/Cog Date: 2014-06-11 14:26:16 -0700 Plugins: r2954 http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins
CoInterpreter VMMaker.oscog-eem.746 uuid: cc4961d3-e629-4e28-b308-88eab314a8c9 Jun 11 2014
StackToRegisterMappingCogit VMMaker.oscog-eem.766 uuid: 3045c341-cfbf-494c-a7b1-fb29c26a7340 Jun 11 2014

Run FFI-Test -> 32 run, 32 passes, 0 expected failures, 0 failures, 0 errors, 0 unexpected passes


The error in FFI-Unix is strange. The last package comment from
Name: FFI-Unix-mtf.4
Author: mtf
is
"made the XLib examples actually work (Window is an unsigned int handle, not a struct)"

That the window is an int handle and not a struct explains why this version replaces the parent class
of XDrawable from ExternalStructur to Object. But all calls with an XDrawable still have this
object as parameter ( and not its instance var "xid"). I don't understand how this ever
worked (or was there some kind of automatic argument conversion like:
transform an object with an instvar -> a int, if the function expects an int handle?)

Sure we can replace all XDrawable arguments in X11 calls from "aXDrawable" to "aXDrawable xid".
But I only wonder, did this ever work and if Author "mtf" did the last change, can I contact
him or is he still maintaining the FF-Unix examples?


I would like to raise this topic again.

Nothing has changed, the linux example still don't work and I
can not get information about who maintains the unix-examples.

From my analysis (see above), the fix may be simple (in another discussion
around that time some one else asked how to make that working, and confirmed it
works with that fix). But I am confused because the latest update for the examples had
the comment "made the XLib examlpes actually work". So maybe my usage or version
of FFI is wrong.

The last time I asked, someone said this works for him with the current stable vm, but it was
actually the latest cog vm he used.

But now, a year later, with the current 4.6 cog and 5.0 spur vm, some FFI unit tests still failing
so maybe I am using the wrong FFI package (FFI-Kernel-EstebanLorenzano.27) ?

(BTW, there is a typo in
ExternalAddress class >> loadSymbol: moduleSymbol module: module
    <primitive: 'primitiveLoadSymbolFromModule' module: 'SqueakFFIPrims'>
    ^ self primitiveFail
it should call
    ^ self primitiveFailed



 


>
> regards
> Nicolai

Eliot (phone)