[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] A more concrete FFI question.
From: |
Robin Lee Powell |
Subject: |
[Chicken-users] A more concrete FFI question. |
Date: |
Tue, 3 Jul 2007 17:00:43 -0700 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
The following C code (trimmed) works fine:
xmmsc_connection_t *connection;
xmmsc_result_t *result;
unsigned int id;
result = xmmsc_playback_current_id (connection);
xmmsc_result_wait (result);
if (!xmmsc_result_get_uint (result, &id)) {
fprintf (stderr, "xmmsc_playback_current_id didn't"
"return uint as expected\n");
}
printf ("Currently playing id is %d\n", id);
The following Chicken does not:
(let-location ([ret unsigned-int 275])
(let* (
[res ($ c-pointer xmmsc_broadcast_playback_current_id
(c-pointer conn))]
[null ($ void xmmsc_result_wait (pointer res))]
[boring-ret ($ int xmmsc_result_get_uint (pointer res)
(location ret))])
(display (conc "Currently playing test : " boring-ret ", " ret
"\n"))))
The value in "ret" is always whatever value I initialize it to, like
it's not getting touched at all.
I don't, at all, understand the explanations for let-location,
location, or pointer (there being not much explanation for any of
them), so I'm sure I'm doing something wrong.
-Robin
- [Chicken-users] A more concrete FFI question.,
Robin Lee Powell <=