Re: Dll's

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

Paul Martin wrote:

> Hello again,
>
> Sorry, I have a couple more questions. I ran into this while looking over
> the code for
> GLUT, and I'm not sure how to handle it.
>
> /* Stroke font opaque addresses (use constants instead in source code). */
> extern void *glutStrokeRoman;
>
> /* Stroke font constants (use these in GLUT program). */
> #define GLUT_STROKE_ROMAN               (&glutStrokeRoman)
>
> What is going on here, and is there a way to port this into Euphoria?
>

Okay, well in C, the "extern" keyword defines an external variable, or, in
other words, lets the compiler know that a variable with the given name
exists, but it's going to be defined somewhere else, but, no, that can't
really be ported to Euphoria, because those are just variable declarations..

>
> I also ran into this:
>
> extern void APIENTRY glutButtonBoxFunc(void (*)(int button, int state));
>
> Is this passing a pointer to a structure containing button, and state?

Nope.  That's passing a pointer to a function.

Example:
   /* Define a pointer to a function */
   void (*__void_func)(int i);

   /* Make __void_func point to exit() */
   __void_func = exit;

   /* Call the function that __void_func points to */
   (*__void_func)(1);

I'm not sure if that right there will help, but, if you wanna pass a function
pointer to a C routine, first, you'll have to create a Euphoria routine, get
the address of it through the call_back() function, and pass that value to the
C function you're trying to call..  Or something like that..  Erm, well, I
hope I made sense..  *heh*

>
>
> Thanks
> Paul Martin

Austin Cathey (aka The AfterBeat)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu