functionPointer is the pointer to the GetVersion function.
The result should be 65542 (16r00010006), which is also what I get when calling the function from VisualWorks, but the method answers -394042288 (-16r177C9BB0). The "result" Alien has the printString '#[0 0 0 0 6 0 1 0]' which suspiciously contains the 1 and the 6 I am looking for, but in the wrong places. ;-)
I looked at examples for callouts, which seem to indicate that result should be the Alien and not a pointer to it. So I changed the code to
result := (Alien newC: 4).
primFFICallResult: result pointer
with: self asJNIParameter.
^result signedIntAt: 1
This didn't really help. The result is now 0 (zero), although the Alien prints as #[252 255 255 255 80 15 38 0] which doesn't look like a 0 at first sight.
Am I using those Aliens in a correct way? What can I try to debug this?
If this is too obscure and someone who knows about Aliens would like to have a look at the rest of the code, I am willing to send a bunch of Monticello packages and instructions for reproducing the problem, but I won't make it publicly available yet.