[rdnzl-devel] Rdnzl Problem

Iver Odin Kvello iverodin at gmail.com
Mon Feb 4 10:22:10 UTC 2008


With this invocation, I think pretty-print-CPC would actually return NIL:

[Application.Run (new "CPC_interface" (new "callback" #'(lambda
(filename) (pretty-print-cpc filename t)) ))]

so I'm guessing it was actually called with echo set to NIL. I think I
can reproduce something like this myself,
I don't understand why I haven't seen it before, but it seems
something happens with values returned from lisp to .Net.
(This is on the 3.5 framework, however, but tested on both lispworks and ACL).

> 1. Can you run the Apropos example that comes with RDNZL without
>    problems?  It uses a delegate with the same signature.

It defines a delegate "callback" with the same signature, but it isn't
actually used; the delegate actually used is a KeyPressEventHandler,
and the closure it wraps doesn't actually return a value, and if what
I'm seeing is the same, only return-values passed from lisp to .Net
are affected.

Shortest example is, given a delegate type

  public delegate Int32  intcallback (String input);

(doing this with a return-type of String crashes my lisp)

  (setf callback (new "TestLib.intcallback" (lambda (x) (length x))))
  (invoke callback "Invoke" "hey")

returns 1762921488 . I've done a bit of debugging, and there is no
doubt that arguments are passed correctly to the lisp function, which
is called correctly, and which produces the correct value. Also, the
above result is seen not only when passing the result back to lisp
again, but also when the callback is called from .Net and for example
displayed on screen with a MessageBox. When the callback is called for
effect, there is no problem.

I've tried to return boxed values from the lisp-callback as well with
the same result. Obviously some pointer is pointing in the wrong
direction here, but I haven't gotten deep enough yet to find the
actual bug.

For the original problem, if this is the problem and not the character
encoding, it should work as a band-aid to call a .net function instead
of returning the value as a string, that is, in pretty-print-CPC do
something like

  (invoke myCPCInterface "RecievePrettyPrintedCPC" (format echo ...

Regards, Iver



More information about the rdnzl-devel mailing list