<div dir="ltr"><div><div>Hi Matt,</div><div><br></div><div>Thanks for your answer - and sorry for my late reply!</div></div><div><br></div>On Thu, Jul 18, 2013 at 2:39 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Sun, 14 Jul 2013 00:31:27 +0900<br>Dietrich Bollmann <<a href="mailto:dietrich@formgames.org">dietrich@formgames.org</a>> wrote:<br>
<br>> I compiled my ECL lisp functions with asdf:make-build into a library.<br>><br>> Some functions depend on the value of a global variable which has to be set<br>> in the code using the library.<br>><br>
> But when changing the value of the global variable in the code using the<br>> library, the library functions still use the old value...<br><br></div>I don't really understand why in your example code only the original<br>
value is obtained, possibly that the scope of the variable is not the<br>expected one (that there are two such variables or such)? I recommend<br>to use (setf c::*delete-files* nil) and to inspect the resulting C code.<br>
</blockquote><div><br></div><div>I seem to be unable to understand myself. </div><div><br></div><div>But approaching the problem by </div><div><br></div><div> - using a static variable together with a lisp setter and getter and</div>
<div> - compiling the lisp files to a library with ASDF:MAKE-BUILD</div><div><br></div><div>results in a working solution. This one is more elegant anyway, so I will just continue with this one.</div><div><br></div><div>
Just for reference I'll send the sources of two failing attempts as well as those of two working solutions to the list. See the attachment to the next email responding to Juanjo's answer.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Note also that for handling foreign pointers (other than :pointer-void<br>with C-INLINE which it handles implicitely), there are the public<br>interfaces ecl_make_pointer() and ecl_to_pointer().<br></blockquote><div><br></div>
<div>Thanks!</div><div><br></div><div>These are the functions I was looking for!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
In your next message I see that you seem to be doing it right to store<br>the context in a C variable (although I didn't test your code). If<br>it's to store a unique global context on which the Lisp code should<br>
have no control, it might not matter, but otherwise, it might be best<br>to have interface functions require the context parameter or to obtain<br>it from a dynamic/special variable, which would allow Lisp code to<br>handle multiple objects more elegantly than is generally possible from<br>
C/C++ because of the power of dynamic scope...<br></blockquote><div><br></div><div>What do you mean by "dynamic/special variable"?</div><div><br></div><div>But anyway, I rewrote my solution as mentioned before and now use 'ecl_make_pointer()' rather than my own complicated way to wrap the pointer (See the forth version in the code attached to the answer to Juanjo). This looks good enough to me and I will use this one from now on!</div>
<div><br></div><div>Thanks again for your help!</div><div><br></div><div>Cheers,</div><div>Dietrich</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
--<br>Matt</blockquote><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 18, 2013 at 2:39 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On Sun, 14 Jul 2013 00:31:27 +0900<br>
Dietrich Bollmann <<a href="mailto:dietrich@formgames.org">dietrich@formgames.org</a>> wrote:<br>
<br>
> I compiled my ECL lisp functions with asdf:make-build into a library.<br>
><br>
> Some functions depend on the value of a global variable which has to be set<br>
> in the code using the library.<br>
><br>
> But when changing the value of the global variable in the code using the<br>
> library, the library functions still use the old value...<br>
<br>
</div>I don't really understand why in your example code only the original<br>
value is obtained, possibly that the scope of the variable is not the<br>
expected one (that there are two such variables or such)? I recommend<br>
to use (setf c::*delete-files* nil) and to inspect the resulting C code.<br>
<br>
Note also that for handling foreign pointers (other than :pointer-void<br>
with C-INLINE which it handles implicitely), there are the public<br>
interfaces ecl_make_pointer() and ecl_to_pointer().<br>
<br>
In your next message I see that you seem to be doing it right to store<br>
the context in a C variable (although I didn't test your code). If<br>
it's to store a unique global context on which the Lisp code should<br>
have no control, it might not matter, but otherwise, it might be best<br>
to have interface functions require the context parameter or to obtain<br>
it from a dynamic/special variable, which would allow Lisp code to<br>
handle multiple objects more elegantly than is generally possible from<br>
C/C++ because of the power of dynamic scope...<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></div>