Re: calling a function in a struct ?

"smallhairytroll" <[email protected]> Thu, 12 Jun 2003 22:42:33 -0000
Newsgroups gmane.lisp.corman
Message-ID <[email protected]>
--- In [email protected], Chris Double <chris.double@d...> 
wrote:
> On Thu, 12 Jun 2003 18:42, smallhairytroll wrote:
> > How would I go about calling a function defined within a struct ?
> 
> I think this came up about 2 months ago in the mailing list.

Not that I am a whiner or anything :) The closest matches I can come 
up with are both from John Pallister, one dealing with copying 
structs, the other dealing with ct::valid-callback-arg-type not 
taking pointers to (or arrays of) structures.

http://groups.yahoo.com/group/cormanlisp/message/1429
http://groups.yahoo.com/group/cormanlisp/message/1428

Like I say, it's not a callback I'm after. The SDL guys went OO for 
a minute and have a structure that contains several functions 
(similar to a class having members). The (*seek) function retrieves 
bytes contained in the SDL_RWops structure.

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

#define SDL_RWseek(ctx, offset, whence)	(ctx)->seek(ctx, offset, 
whence)

(I think it's time I created a Corman Lisp FFI FAQ containing 
answers to the questions I have asked the group).

-Luke


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