[Prev][Next][Index][Thread]
Using C structs with FD 2.0 FFI
-
To: info-dylan@ai.mit.edu
-
Subject: Using C structs with FD 2.0 FFI
-
From: oodl@my-deja.com
-
Date: Tue, 4 Apr 2000 16:45:02 -0400 (EDT)
-
Organization: Deja.com - Before you buy.
-
Xref: traf.lcs.mit.edu comp.lang.dylan:11780
Hello all,
So far I have been very impressed with the Harlequin Dylan C FFI. But I
have started playing with structs now and am having a problem getting a
simple example to work. When I try to run the Dylan code below, I get a
"Dylan error: No next method" error. There is no way to debug it in the
debugger. Can someone tell me what I am doing wrong? I assume I am
doing something stupid, but I don't see it.
-------------------- C code --------------------
typedef struct {
double count;
} Statistics;
int ReadStats (Statistics* stats) {
stats->count = 123;
return 1;
}
-------------------- Dylan code --------------------
define C-struct <Statistics>
slot count :: <C-double>;
pointer-type-name: <Statistics*>;
end;
define C-function read-stats
output parameter stats :: <Statistics*>;
result value :: <C-int>;
c-name: "ReadStats"
end;
define method main () => ()
format-out("started...\n");
let (result, stats) = read-stats();
format-out("stats %=\n", stats.count);
end method main;
Sent via Deja.com http://www.deja.com/
Before you buy.
Follow-Ups: