Re: Function Passing

new topic     » goto parent     » topic index » view thread      » older message » newer message

Adam Weeden writes:
> // C++ Pseudo-Code for OpenGL
>
> void DispFunc(void)
> {
>     // Do whatever displaying you need here.
> }
>
> void main(void)
> {
>    glDisplayFunc(DispFunc)  // Passing the function DispFunc
>                                          // as a parameter.
> }

> How could I mimic this in Euphoria...

*** warning - untested code ahead:

1. Define function DispFunc() in Euphoria code
    as a function of 0 parameters.
     It has to be function - just return 0 or something.
    The returned value will be ignored.

2. Get the address of this Euphoria function with:
           atom addr
           addr = call_back(routine_id("DispFunc"))

3. link to glDisplayFunc using
        lib = open_dll("....")
       gld = define_c_proc(lib, "glDisplayFunc", {C_POINTER}).

4. Call glDisplayFunc() using:
       c_proc(gld, {})

> P.S. I tried to send this directly to Rob at rds at attcanada.net
> and it said I wasn't allowed to send him mail.  I didn't
> know you hated me so much Rob :-}

My ISP's mail server was down today for a few hours.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://members.aol.com/FilesEu/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu