[REBOL] Re: callbacks
From: moliad:g:mail at: 30-Oct-2007 1:35
hi all,
well, seems the instability really is related with the GC being sort of
pre-emptive hehe it thinks the ram is not usefull anymore... but we are
inside the callback itself and bam... it crashes. the moment we play with a
callback's arguments, setting one to none or even within a function which
is called by the callback...
so I had to allocate a Global word and set one of the callback's values to
that word, as the first operation of the callback... I even had to convert
the interface, set one to char* so rebol's GC would track its pointer use...
from that point on, the whole system became totally stable, even with
recycle/on being called repeteadly.
because I set one of the interace's values to a char* I had to extract the
address of the string and use two other methods from peekpoke to retrieve
the original value which was a double float array to start with!
so, overall, the callback is not for the faint of heart, but if you are
patient, and tweak here and there, you can eventually get you want. note
that you will not do much, if you do not also use the EXCELLENT
peekpoke.rpower library over at ladislav's site. Cause in many cases,
the callbacks
use much more complex datastructures than what is available out of the box
in rebol.
I am able to convert double float variable length arrays being sent to me
and other nice things, but without the peekpoke lib, I'd be quite lost
indeed.
-MAx
On 10/30/07, Maxim Olivier-Adlhoch <moliad-gmail.com> wrote: