Opened 13 years ago
Closed 9 years ago
#251 closed defect (fixed)
CFFI callbacks don't unbox integer values
| Reported by: | stassats | Owned by: | Mark Evenson |
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.4.0 |
| Component: | libraries | Version: | 1.1.0-dev |
| Keywords: | quicklisp cffi cl+ssl | Cc: | stassats@… |
| Parent Tickets: |
Description
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)
comment:1 Changed 13 years ago by
| Cc: | stassats@… added |
|---|
comment:2 Changed 13 years ago by
| Component: | java → libraries |
|---|---|
| Keywords: | quicklisp cffi jna added |
| Owner: | changed from nobody to Mark Evenson |
comment:3 Changed 13 years ago by
| Priority: | major → critical |
|---|---|
| Status: | new → accepted |
comment:4 Changed 13 years ago by
| Keywords: | hunchentoot added |
|---|---|
| Priority: | critical → major |
comment:5 Changed 13 years ago by
| Milestone: | 1.1.0 → 1.1.1 |
|---|---|
| Summary: | ffi callbacks don't unbox integer values → CFFI callbacks don't unbox integer values |
Problem is with upstream cffi abcl implementation, so does not block abcl-1.1.
comment:6 Changed 13 years ago by
| Milestone: | 1.1.1 → 1.1.0 |
|---|---|
| Resolution: | → worksforme |
| Status: | accepted → closed |
comment:7 Changed 13 years ago by
| Milestone: | 1.1.0 → 1.2.0 |
|---|
comment:8 Changed 13 years ago by
| Resolution: | worksforme |
|---|---|
| Status: | closed → reopened |
comment:10 Changed 13 years ago by
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
comment:11 Changed 13 years ago by
| Keywords: | hunchentoot removed |
|---|
No longer blocks hunchentoot, but CFFI stills fails when actually trying to use CL+SSL.
comment:12 Changed 13 years ago by
| Keywords: | cl+ssl added; jna removed |
|---|
comment:13 Changed 13 years ago by
| Priority: | major → blocker |
|---|
comment:14 Changed 12 years ago by
| Milestone: | 1.2.0 → 1.3.0 |
|---|
comment:17 Changed 12 years ago by
| Milestone: | 2.0.0 → 1.4.0 |
|---|
comment:19 Changed 9 years ago by
| 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.