Hi,
I'm trying to insert a callback-handler in an assembly here. The apropos example works great, but this assembly is giving me problems. I'm doing like this:
(defun handle-update (argument) argument)
[+OnUpdate *object* (new "OnUpdateEvent" #'handle-update)]
Check with C# code that the callback only requires one argument. The callback is supposed to return void, but it looked like the adapter-thing should take care of that?
Anyway, when the callback fires, I get the following error with Lispworks 4.3.7 for Windows, and rdnzl 0.7.0
Failed to find stack-no 0000026c stack 03d4f95 Stack dump 03d4f940 03d4f940 20002f2c 00000c45 03d4fa40 03d4f950 03d4f950 03d4f968 209775b9 00000000 03d4f960 00000010 0000026c 03d4f980 2000c423 03d4f970 2139219c 03d4f9ac 011343cc 0113b5f4 03d4f980 03d4f9f0 03199984 03199984 03199984 03d4f990 00000001 03db0fb0 0113b5f4 011343cc 03d4f9a0 00f2a048 0113b5f4 011343cc 791b4788 03d4f9b0 03d4fd40 00000000 03d4f990 03199984 03d4f9c0 001ac270 03d4fb34 00d52f76 03d4f9f0 03d4f9d0 0113b5f4 011343cc 001ac270 03db0fb0 03d4f9e0 0113b5f4 03d4fb34 00000000 03199870 03d4f9f0 03d4fb34 0319985c 00f2a298 00000000 03d4fa00 0113b338 03196a54 00000000 03d4fb54 03d4fa10 03d4fb78 791b308a 011268f0 0112682c 03d4fa20 011267c4 0113b020 0113aff8 011268f0 03d4fa30 0112682c 00f2a048 00000000 00000000
Any clues?
Hi!
On Sat, 30 Jul 2005 00:39:52 +0200, Kai E remarvinator@gmail.com wrote:
I'm trying to insert a callback-handler in an assembly here. The apropos example works great, but this assembly is giving me problems. I'm doing like this:
(defun handle-update (argument) argument)
[+OnUpdate *object* (new "OnUpdateEvent" #'handle-update)]
Check with C# code that the callback only requires one argument. The callback is supposed to return void, but it looked like the adapter-thing should take care of that?
Yep.
Anyway, when the callback fires, I get the following error with Lispworks 4.3.7 for Windows, and rdnzl 0.7.0
[...]
Any clues?
No, sorry, not from the description above. Could you send a small self-contained example (Lisp and C# code) which is sufficient to reproduce the error?
Thanks, Edi.
Thanks for your reply.
No, sorry, not from the description above.
Aight, was just hoping to be lucky and that you had seen it before. :)
Could you send a small self-contained example (Lisp and C# code) which is sufficient to reproduce the error?
Yep, will try to do. I don't have the source for the assembly I'm using, but I'm trying to get it now, as well as information about how it was compiled.
The following testcase works like a dream, but it's what I'll try to modify to fail if I'm able to get my hands on the code in question.
<code> using System;
namespace DT // short for DelegateTest { public delegate void DTDelegate(int count);
class DTClass { public event DTDelegate DTEvent;
public void Start() { for( int i = 0; i < 10; i++ ) DTEvent(i); } } } </code>
<code> c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\csc.exe /target:library DT.cs </code>
<code> (import-types "DT" "DTDelegate" "DTClass")
(use-namespace "DT")
(defun try-it () (let ((dt (new "DTClass"))) [+DTEvent dt (new "DTDelegate" #'handle-event)] [Start dt]))
(defun handle-event (counter) (format t "~a~%" counter)) </code>