ffi:defcallback with cxx
daniel at turtleware.eu
Fri Nov 13 10:12:23 UTC 2015
thanks for the report!
Inlining is somewhat broken. Direct casting of a function into (void*)
is undefined behavior in C afaik but that's what we'll do.
Please consult this issue:
hiro hiro writes:
> I compiled ecl16.0.0 with option "--with-cxx".
> Then I use ffi:defcallback function like
> (ffi:defcallback yyyy :void () ..... )
> then compile-file
> (compile-file "xxxxx.lisp" :c-file "xxxxx.cpp" :system-p t)
> I received error message as follows
> (freebsd10.1 clang++)
> xxxxx.cpp:162:8: error: no matching function for call to
> T0 =
> I try as follows
> in src/cmp/cmpcbk.lsp & src/new-cmp/cmpc-cbk.lsp line 44
> ,(format nil "ecl_make_foreign_data(@':pointer-void,0,~a)" c-name)
> ,(format nil "ecl_make_foreign_data(@':pointer-void,0,(void*)~a)"
I've added main part of your mail to the abovementioned issue. I won't
incorporate this fix directly because I remember I did similar stuff
//casting to (void*)obj, or even casting to (void**)&obj// at my last
attempt when working on this issue but it was breaking arm builds. When
I'll confirm it doesn't break a builds I'll add it along with other
changes and the appropriate patch to CFFI.
> after that, I did not receive error message and ffi:callback work fine.
> Would you let me know what your thoughts are on this matter.
Generally use CFFI's defcallback. It does just that but without inlining
(I've disabled inlining to make things working and left issue opened to
work on it when I'll find time/incentive to do it).
As a sidenote, according to Juan (I've asked him about the newcmp)
newcmp was a failed experiment and it doesn't build anyway. src/cmp/*
changes were enough. I'll remove the `new-cmp' directory before the next
release to avoid unnecessary confusing of people approaching the
Once again - thanks for the report :-)
Daniel Kochmański ;; aka jackdaniel | Poznań, Poland
TurtleWare - Daniel Kochmański | www.turtleware.eu
"Be the change that you wish to see in the world." - Mahatma Gandhi
More information about the ecl-devel