I've just moved over from Java to C++ and I've never used macros before and I'm confused how some methods seem to return two variables, such as
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM)
or even stranger combinations like
JNIEXPORT jdoubleArray JNICALL Java_algorithms_Shuffle0_getPriorities (JNIEnv *, jobject, jint, jint).
Can someone tell me what's going on? Sorry if this seems like extreme ignorance, but as I say I've never used macros before and The Complete Reference to C++ chapter on the preprocessor doesn't make these arrangements any clearer.
You need to expand each macro to fully understand it. Run your code through the pre-processor to see how it expands, or use your helpful IDE tools to show you.
When you do so you will see the following:
LRESULT is the result type. It's an integer of some description.CALLBACK defines the calling convention which would be __stdcall.And as for the other one:
JNIEXPORT probably expands to declspec(dllexport). This specifies that the function is to be exported from the library.jdoubleArray is the return value.JNICALL will be the calling convention.You can think of these extra tokens as being decorators to the function. They do not change the signature of the function at a conceptual level. Probably the closest analogous concept in Java would be attributes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With