Re: Using a cl_object in Lisp

"Stewart M." <sjm-mail-g/[email protected]>
Newsgroups gmane.lisp.ecl.general
Message-ID <mjTs_mAHJL00xXQHhr8alpngJ2va0R2zaVmyk2uIaOYNJrhwTe6SJOlTru0fLe2D4qYpSYRcTCLrRQsy7JiL2Z8LsvhltBfNCWMK3kk5hTI=@protonmail.com>
To clarify, the issue is not with C++, which I am successfully wrapping with C.

The actual issue is using the c_object type in Lisp--if it comes back as a CFFI pointer, how can I use it in Lisp as a Lisp object?  Is there something like:

  (ffi:pointer-to-lisp-object ptr)

--
Stewart Milberger
Kavalogic, Inc.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On July 28, 2018 2:46 PM, Stewart M. <[email protected]> wrote:

> I am using CFFI with ECL to interface to a C++ library, which has a C++ class with a data member of type 'cl_object'.  Simplified, my C++ code is:
>
>   class LispObject
>   {
>   public:
>     cl_object object;
>   };
>
>   extern "C" cl_object getObject(LispObject* lo) { return lo->object; }
>   extern "C" void setObject(LispObject* lo, cl_object clo) { lo->object = clo; }
>
> The full code is:
>
>   https://common-lisp.net/viewvc/clive/trunk/src/extensions/corral/CliveCorral/LispObjectImpl.hpp?revision=149&view=markup#l59
>
> Can I somehow declare the 'cl_object' type for the 'getValue()' and 'setValue()' functions using CFFI 'defcfun' to get and set ECL objects?  Is there a technique using the lower-level FFI?  I am looking for a way to do this without compiling C code embedded in Lisp, which I am aware ECL can do.
>
> Thank you for any ideas!
>
> --
> Stewart Milberger
> Kavalogic, Inc.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.