<div dir="ltr"><div>Hi Matt,</div><div><br></div>Thank you!<br><br>So the following works:<br><br>(let () (defconstant +xy-plane+ (ffi:c-inline () () :pointer-void "(void *) &ON_xy_plane" :one-liner t)))<br><br>
Here - just for reference - a link to the file contrib/sockets/sockets.lisp:<br><br> <a href="http://sourceforge.net/p/ecls/ecl/ci/master/tree/contrib/sockets/sockets.lisp">http://sourceforge.net/p/ecls/ecl/ci/master/tree/contrib/sockets/sockets.lisp</a><br>
<br>And another simple example with context:<br><br>Example:<br><br> (ffi:clines "#define SOME_CONSTANT 123")<br> (let () (defconstant +some-constant+ (ffi:c-inline () () :int "SOME_CONSTANT" :one-liner t)))<br>
<br>Usage:<br><br> (format t "+some-constant+: ~a~%" +some-constant+)<br><br>Output:<br><br> +some-constant+: 123<br><br>I summarized your comments on the following page: <a href="http://formgames.org/wiki/ECL/Wrapping_constants">http://formgames.org/wiki/ECL/Wrapping_constants</a><div>
<br></div><div>Does it make sense to copy this / parts of it into the ECL Wiki?</div><div><br></div><div>All the best,</div><div><br></div><div>Dietrich</div><div><br><div><br></div></div></div><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Fri, Jul 12, 2013 at 12:35 AM, Matthew Mondor <span dir="ltr"><<a href="mailto:mm_lists@pulsar-zone.net" target="_blank">mm_lists@pulsar-zone.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, 11 Jul 2013 20:26:11 +0900<br>
Dietrich Bollmann <<a href="mailto:dietrich@formgames.org">dietrich@formgames.org</a>> wrote:<br>
<br>
> I want to wrap a pointer to a C++ constant into a lisp constant.<br>
><br>
> The following<br>
><br>
> (defconstant +xy-plane+<br>
> (ffi:c-inline () () :pointer-void "(void *) &ON_xy_plane" :one-liner t))<br>
><br>
> results in this error:<br>
</div>[...]<br>
<div class="im">><br>
> But this - at least to me - looks kind of unnecessarily cumbersome...<br>
><br>
> Is there a better way to wrap a pointer to a constant from lisp?<br>
<br>
</div>It's necessary to wrap those DEFCONSTANT inside a LET block so they are<br>
no longer top-level, see how contrib/sockets/sockets.lisp in the ECL<br>
source tree does it for instance.<br>
--<br>
Matt<br>
<br>
------------------------------------------------------------------------------<br>
See everything from the browser to the database with AppDynamics<br>
Get end-to-end visibility with application monitoring from AppDynamics<br>
Isolate bottlenecks and diagnose root cause in seconds.<br>
Start your free trial of AppDynamics Pro today!<br>
<a href="http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk" target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk</a><br>
_______________________________________________<br>
Ecls-list mailing list<br>
<a href="mailto:Ecls-list@lists.sourceforge.net">Ecls-list@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/ecls-list" target="_blank">https://lists.sourceforge.net/lists/listinfo/ecls-list</a><br>
</blockquote></div><br></div>