Re: Help with callbacks
Chris Double <[email protected]> Sun, 8 Jun 2003 19:35:55 +1200
| Newsgroups | gmane.lisp.corman |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 08 Jun 2003 10:13, smallhairytroll wrote:
> And this is how I call the timer:
>
> (setf f-pointer (ct:create-foreign-ptr))
> (setf var-1 (ct:malloc (ct:sizeof :LONG)))
> (setf (ct:cpointer-value f-pointer) (ct:cpointer-value var-1))
>
> (setf a-timer-1 (SDL_AddTimer
> 1000
> (ct:get-callback-procinst 'my-timer-func-1) f-pointer))
>
> However Corman crashes after the 1000ms when SDL tries to call the
> function. What am I doing wrong ?
What happens if you instead try:
(setf var-1 (ct:malloc (ct:sizeof :LONG)))
(setf (ct:cref (:long *) var-1 0) 0)
(setf a-timer-1 (SDL_AddTimer
1000
(ct:get-callback-procinst 'my-timer-func-1) var-1))
From the looks of things SDL_AddTimer expects a pointer to some allocated
memory that it will in turn pass to your function. Creating a pointer to a
long as above and just passing that should work. I'm not sure what
create-pointer and the like do but I don't think you need to use it here.
Chris.
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get A Free Psychic Reading! Your Online Answer To Life's Important Questions.
http://us.click.yahoo.com/Lj3uPC/Me7FAA/ySSFAA/SyjtlB/TM
---------------------------------------------------------------------~->
To unsubscribe from this group, send an email to:
[email protected]
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/