[rdnzl-devel] New versions 0.8.0/0.5.0 (was: bug in delegate adapter release mechanism)

Edi Weitz edi at agharta.de
Fri Jan 13 07:37:30 UTC 2006

Hi Dominic!

On Fri, 13 Jan 2006 00:29:08 +0000, "lisp" <lisp at spikeisland.com> wrote:

> I've tracked down what looks to be a bug in the mechanism for
> releasing delegate adapters.
> The foreign callable ReleaseDelegateAdapter is declared with a
> return type of ffi-void-pointer but tries to return the result of
> remhash - a boolean. On LWW (at least) this results in:
> Condition: T cannot be converted to foreign type :POINTER. Call to 
> I would suggest changing it (and the corresponding initialisation
> and DLL code) to have a void return type:
> (ffi-define-callable (ReleaseDelegateAdapter ffi-void) 
>  ((index ffi-integer)) ;; remove entry from hash table if CLR is done with it
>  (remhash index *callback-hash*))
> Also, in DelegateAdapter.cpp you have a comment on the destructor
> that it doesn't appear to be working:
> // the destructor notifies Lisp that this instance is no longer used -
> // at least in theory, this doesn't seem to work right now
> DelegateAdapter::~DelegateAdapter() {  release(indexIntoLisp); }
> This may have beeen the caused by the callback/threading issues
> discussed recently.  At least it has certainly worked for me here
> (hence this bug report) when using a DLL based LWW image (many
> thanks for your recent example of this).  Perhaps the .NET GC is
> running in a different thread, so the callback was failing in a
> normal .EXE image?

Makes perfect sense to me.  I've updated both the Lisp and the C++
code according to your recommendations - see ChangeLogs below.

However, I'm a bit in a hurry and I couldn't figure out an easy
example which shows that ReleaseDelegateAdapter is actually called -
at least not from a DLL-based LWW image.  Could you please check if it
works and report back to the list if possible?

Thanks a lot,

  Lisp code:

  Version 0.8.0
  Fix mechanism which releases delegate adapters (thanks to Dominic Robinson)
  Updated to DLL version 0.5.0


  C++ code (optional):

  Version 0.5.0
  Fix mechanism which releases delegate adapters (thanks to Dominic Robinson)


More information about the rdnzl-devel mailing list