What does the following statement do in C++?
(*JImageGetResource)(jimage, location, val, size);
This instruction is taken from here.
What does the following statement do in C++?
(*JImageGetResource)(jimage, location, val, size);
This instruction is taken from here.
 
    
     
    
    There's no cast involved. JImageGetResource is a pointer, by adding * in front of it, it will be dereferenced.
Typically you will see this with iterators for example.
In your case it's a function pointer. So the resulting code would be the same as resultingFunction(jimage, location, val, size).
In line 1017: JImageGetResource = CAST_TO_FN_PTR(JImageGetResource_t, dll_lookup(handle, "JIMAGE_GetResource", path));
 
    
    No, that is no cast, because the thing in the left bracket is no type. It is an usual function call.
The left bracket dereference the pointer JImageGetResource, and the obtained object is something that can be called with 4 arguments.
 
    
    Taking this declaration into account
static JImageGetResource_t             JImageGetResource      = NULL;
it means that the name JImageGetResource identifies a pointer of the type JImageGetResource_t that is initialized by NULL.
Also this record
 JImageGetResource = CAST_TO_FN_PTR(JImageGetResource_t, dll_lookup(handle, "JIMAGE_GetResource", path));
is self-documented and means JImageGetResource denotes a function pointer.
So this expression statement
(*JImageGetResource)(jimage, location, val, size);
represents a function call with four arguments.
This record could be written also like
JImageGetResource(jimage, location, val, size);
or to make a more obfuscating code (due to the implicit conversion of a function designator to pointer to the function) even like:)
(***JImageGetResource)(jimage, location, val, size);
Here is a demonstrative program.
#include <iostream>
void hello( const char *s )
{
    std::cout << "Hello " << s << '\n';
}
typedef void ( *hello_t )( const char * );
int main() 
{
    hello_t fp = NULL;
    
    fp = hello;
    
    fp( "Michael Munta" );
    ( *fp )( "Michael Munta" );
    ( ***fp )( "Michael Munta" );
    
    return 0;
}
Its output is
Hello Michael Munta
Hello Michael Munta
Hello Michael Munta
