#251: ffi callbacks don't unbox integer values -----------------------+---------------------------------------------------- Reporter: sboukarev | Owner: nobody Type: defect | Status: new Priority: major | Milestone: 1.1.0 Component: java | Version: 1.1.0-dev Keywords: | -----------------------+---------------------------------------------------- It very well may be a cffi issue.
Compile the following C code with gcc -shared test.c -o test.so
{{{ #ifdef WIN32 #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT #endif
DLLEXPORT short test(short (*f)(short, short)) { return f(23, 24); } }}}
Then
{{{ (cffi:load-foreign-library "/tmp/test.so")
(cffi:defcfun test :short (function :pointer))
(cffi:defcallback (test-callback) :short ((a :short) (b :short)) (+ a b))
}}}
And finally
{{{ (test (cffi:get-callback 'test-callback)) => The value #<java.lang.Short 23 {5EE76547}> is not of type NUMBER. }}}
That's on 64-bit x86 linux, with OpenJDK 1.6.0_24 and jna downloaded by maven.
#251: ffi callbacks don't unbox integer values -----------------------+---------------------------------------------------- Reporter: sboukarev | Owner: nobody Type: defect | Status: new Priority: major | Milestone: 1.1.0 Component: java | Version: 1.1.0-dev Keywords: | -----------------------+---------------------------------------------------- Changes (by sboukarev):
* cc: stassats@… (added)
#251: ffi callbacks don't unbox integer values --------------------------------+------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: new Priority: major | Milestone: 1.1.0 Component: libraries | Version: 1.1.0-dev Keywords: quicklisp cffi jna | --------------------------------+------------------------------------------- Changes (by mevenson):
* keywords: => quicklisp cffi jna * owner: nobody => mevenson * component: java => libraries
#251: ffi callbacks don't unbox integer values --------------------------------+------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: accepted Priority: critical | Milestone: 1.1.0 Component: libraries | Version: 1.1.0-dev Keywords: quicklisp cffi jna | --------------------------------+------------------------------------------- Changes (by mevenson):
* priority: major => critical * status: new => accepted
#251: ffi callbacks don't unbox integer values --------------------------------------------+------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.0 Component: libraries | Version: 1.1.0-dev Keywords: hunchentoot quicklisp cffi jna | --------------------------------------------+------------------------------- Changes (by mevenson):
* keywords: quicklisp cffi jna => hunchentoot quicklisp cffi jna * priority: critical => major
Comment:
Need some basic macrology--and a reasonable abstraction of type-- in [ABCL's cffi-sys:convert-args-to-lisp-values][cffi-abcl]
[cffi-abcl]: https://github.com/easye/cffi/commit/c630aaf3b41501d3d2ac60b94461f96627fce62...
No longer critical, as CL+SSL at least sort of loads. Callbacks still fail (sometimes) until the types are properly reasoned about.
#251: CFFI callbacks don't unbox integer values --------------------------------------------+------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: accepted Priority: major | Milestone: 1.1.1 Component: libraries | Version: 1.1.0-dev Keywords: hunchentoot quicklisp cffi jna | --------------------------------------------+------------------------------- Changes (by mevenson):
* milestone: 1.1.0 => 1.1.1
Comment:
Problem is with upstream cffi abcl implementation, so does not block abcl-1.1.
#251: CFFI callbacks don't unbox integer values -------------------------+-------------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: closed Priority: major | Milestone: 1.1.0 Component: libraries | Version: 1.1.0-dev Resolution: worksforme | Keywords: hunchentoot quicklisp cffi jna -------------------------+-------------------------------------------------- Changes (by mevenson):
* status: accepted => closed * resolution: => worksforme * milestone: 1.1.1 => 1.1.0
#251: CFFI callbacks don't unbox integer values -------------------------+-------------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: closed Priority: major | Milestone: 1.2.0 Component: libraries | Version: 1.1.0-dev Resolution: worksforme | Keywords: hunchentoot quicklisp cffi jna -------------------------+-------------------------------------------------- Changes (by mevenson):
* milestone: 1.1.0 => 1.2.0
#251: CFFI callbacks don't unbox integer values ------------------------+--------------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: reopened Priority: major | Milestone: 1.2.0 Component: libraries | Version: 1.1.0-dev Resolution: | Keywords: hunchentoot quicklisp cffi jna ------------------------+--------------------------------------------------- Changes (by mevenson):
* status: closed => reopened * resolution: worksforme =>
#251: CFFI callbacks don't unbox integer values ------------------------+--------------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: reopened Priority: major | Milestone: 1.2.0 Component: libraries | Version: 1.1.0-dev Resolution: | Keywords: hunchentoot quicklisp cffi jna ------------------------+---------------------------------------------------
Comment(by mevenson):
pointerp and null-pointer-p don't work on non-pointers
#251: CFFI callbacks don't unbox integer values ------------------------+--------------------------------------------------- Reporter: sboukarev | Owner: mevenson Type: defect | Status: reopened Priority: major | Milestone: 1.2.0 Component: libraries | Version: 1.1.0-dev Resolution: | Keywords: hunchentoot quicklisp cffi jna ------------------------+---------------------------------------------------
Comment(by sboukarev):
pointerp and null-pointer-p are not related. The problem now with the return value from the callback.
JNA: Callback $Proxy2@7dc6a657 threw the following exception: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Short
armedbear-ticket@common-lisp.net