calling a function in a struct ?

"smallhairytroll" <[email protected]> Thu, 12 Jun 2003 06:42:32 -0000
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
How would I go about calling a function defined within a struct ? 

typedef struct SDL_RWops {
  int (*seek)(struct SDL_RWops *context, int offset, int whence);
}

I have the FFI definitions:

(PROGN
    (EXPORT '(SEEK_P))
    (DEFCTYPE SEEK_P (:VOID *)))

(PROGN
    (EXPORT '(SDL_RWOPS))
    (DEFCSTRUCT
        SDL_RWOPS
        ((SEEK SEEK_P))))

Something like this ?

(setf func-pointer (ct:create-foreign-ptr))
(setf (ct:cpointer-value func-pointer) 
      (ct:cpointer-value (ct:cref SDL_RWOPS *rwops* seek)))

Which sets func-pointer to the address of the seek function. But how 
do I go about calling the function with parameters ?

-Luke


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