Re: Re: calling a function in a struct ?

"Chris Double" <[email protected]> Fri, 13 Jun 2003 11:01:13 +1200
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
On Thu, 12 Jun 2003 22:53:58 -0000, "smallhairytroll"
<[email protected]> said:
> 
> typedef struct SDL_RWops {
> int (*seek)(struct SDL_RWops *context, int offset, int whence);
> }
> 
> seek is of type (:void *), so, dereference seek to get the address 
> of the function. Set the first 4 bytes to a SDL_RWops struct, the 
> second 4 bytes to offset and the third 4 bytes to whence.

(defun-pointer seek-ptr ((context (:void *)) (offset :int) (whence :int)) 
  :return-type :int :linkage-type :c)
(defvar rwops (...some way of getting a SDL_RWOps*))
(defvar seek (cref SDL_RWops rwops seek))
(seek-ptr seek rwops 0 0)

Something like that...untested.

Chris.
-- 
  Chris Double
  [email protected]

------------------------ Yahoo! Groups Sponsor ---------------------~-->
Looking for the latest Free IT White Papers?
Visit SearchMobileComputing.com to access over 500 white papers.
Get instant access at SearchMobileComputing.com Today
http://us.click.yahoo.com/9lAzoD/PLNGAA/witMAA/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/