ffi:defcallback with cxx
hiro hiro
hirohiro447 at gmail.com
Sat Nov 14 04:28:59 UTC 2015
Hello,
Thank you for your reply.
Now I am trying direct access wxWidgets GUI library with c-inline.
If CFFI is possible to access C++ library, I will use CFFI.
Best regards,
hirohiro
2015-11-13 19:12 GMT+09:00 Daniel Kochmański <daniel at turtleware.eu>:
> Hey,
>
> 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:
> https://gitlab.com/embeddable-common-lisp/ecl/issues/167
>
>
> hiro hiro writes:
>
> > Hello,
> >
> > 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
> > 'ecl_make_foreign_data'
> > T0 =
> > ecl_make_foreign_data(ECL_SYM("POINTER-VOID",1381),0,ecl_callback_0)
> >
> > I try as follows
> >
> > in src/cmp/cmpcbk.lsp & src/new-cmp/cmpc-cbk.lsp line 44
> > from:
> > ,(format nil "ecl_make_foreign_data(@':pointer-void,0,~a)" c-name)
> > to:
> > ,(format nil "ecl_make_foreign_data(@':pointer-void,0,(void*)~a)"
> > c-name)
>
> 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).
> >
> > hirohiro447
>
> 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
> codebase.
>
> Once again - thanks for the report :-)
>
> Best regards,
> Daniel
>
> --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20151114/5df531ef/attachment.html>
More information about the ecl-devel
mailing list