CFFI callbacks don't unbox integer values
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.
Change History
(19)
| Component: |
java → libraries
|
| Keywords: |
quicklisp cffi jna added
|
| Owner: |
changed from nobody to Mark Evenson
|
| Priority: |
major → critical
|
| Status: |
new → accepted
|
| Keywords: |
hunchentoot added
|
| Priority: |
critical → major
|
| Milestone: |
1.1.0 → 1.1.1
|
| Summary: |
ffi callbacks don't unbox integer values → CFFI callbacks don't unbox integer values
|
| Milestone: |
1.1.1 → 1.1.0
|
| Resolution: |
→ worksforme
|
| Status: |
accepted → closed
|
| Resolution: |
worksforme
|
| Status: |
closed → reopened
|
| Keywords: |
hunchentoot removed
|
| Keywords: |
cl+ssl added; jna removed
|
| Priority: |
major → blocker
|
| Milestone: |
1.5.0 → 1.4.0
|
| Resolution: |
→ fixed
|
| Status: |
reopened → closed
|
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/c630aaf3b41501d3d2ac60b94461f96627fce627
No longer critical, as CL+SSL at least sort of loads. Callbacks still fail (sometimes) until the types are properly reasoned about.