<div dir="ltr"><div style>Hi,<br></div><div style><div><br></div><div>I want to wrap a pointer to a C++ constant into a lisp constant.</div><div><br></div><div>The following </div><div><br></div><div> (defconstant +xy-plane+ </div>
<div> (ffi:c-inline () () :pointer-void "(void *) &ON_xy_plane" :one-liner t))</div><div><br></div><div>results in this error:</div><div><br></div><div> ;;; Error:</div><div> ;;; in file rhino-lisp-api.lisp, position 7235</div>
<div> ;;; at (DEFCONSTANT +xy-plane+ ...)</div><div> ;;; * The form (PROGN (SI:*MAKE-CONSTANT '+xy-plane+ (FFI:C-INLINE NIL NIL :POINTER-VOID "(void *) &ON_xy_plane" :ONE-LINER T)) (SI::REGISTER-GLOBAL '+xy-plane+ )) was not evaluated successfully.</div>
<div> ;;; Error detected:</div><div> ;;; The special form c-inline cannot be used in the interpreter: (NIL NIL POINTER-VOID (void *) &ON_xy_plane ONE-LINER T)An error occurred during initialization:</div><div> COMPILE-FILE-ERROR while</div>
<div> compiling #<cl-source-file "rhino-lisp-api" "rhino-lisp-api">.</div><div> NMAKE : fatal error U1077: 'C:\Users\dietrich\home\cs\lang\lisp\ecl\64\git\install\ecl.exe' : return code '0x1'</div>
<div> Stop.</div><div><br></div><div>So I am currently using a function</div><div><br></div><div> (defun get-xy-plane ()</div><div> (ffi:c-inline () () :pointer-void "(void *) &ON_xy_plane" :one-liner t))</div>
<div><br></div><div>and later</div><div><br></div><div> (defconstant +xy-plane+ (get-xy-plane))</div><div><br></div><div>But this - at least to me - looks kind of unnecessarily cumbersome...</div><div><br></div><div>Is there a better way to wrap a pointer to a constant from lisp?</div>
<div><br></div><div>Thanks, </div><div>Dietrich</div><div><br></div></div></div>