• Advertisement
Sign in to follow this  

kind of blackout...how to use a header

This topic is 1046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi

seems I have a kind of blackout that early in the morning. Well how to use:

 

http://www.xsquawkbox.net/xpsdk/mediawiki/XPLMHandleMouseWheel_f

 

included the header and try:

    XPLMHandleMouseWheel_f (FakeFenster, 1, 1, 1, 1, inRefcon);

 

is wrong obviously. FakeFenster is the windowid and the 1 stand for parameters I don't need? What about refcon?

Thanks

 

Share this post


Link to post
Share on other sites
Advertisement
The documentation clearly states that is not a function you call. You need to write a function which uses the signature and calling conventions shown and then pass a pointer to it to some other SDK function (which is up to you to research). The SDK will then call your function when appropriate with the arguments it chooses as useful.

Share this post


Link to post
Share on other sites
Just to clarify, when you see
 
typedef Type(*Something)(Type, Type);
This is not defining a function called Something. That would look like:
 
Type Something(Type, Type);
The former is declaring a shorthand for a pointer-to-function type. So you can do something like this:
 
Type myFunction(Type a, Type b)
{
}

Type doSomeStuff(Something s)
{
    Type a;
    Type b;

    Type r = s(a, b); // C++ usage, needs to be (*s)(a, b) in C, I think

    return r;
}

void f()
{
    Something s = myFunction;
    doSomeStuff(s);
}
Hope that clarifies. Function pointer syntax is confusing when you first encounter it. Edited by Aardvajk

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement