I'm having a problem with parameter passing when it comes to DOUBLE or double and a pointer to this parameter. I have a double variable holding a value and I make a pointer to this value. The problem is: when I pass this pointer to the function, it won't recognize it as a valid double value and crash the extension at this point.
If I call this function this way, it'll work:
But this will NOT:
myFunction(1, "Hello!", 20.95);
void* pointer = NULL;
double argument = 20.95;
pointer = reinterpret_cast<double*>(&argument);
myFunction(1, "Hello!", pointer);
I MADE A MISTAKE. IT'S THE POINTER WHICH IS PASSED AS ARGUMENT. SORRY
The third parameter expects a DOUBLE and reinterpret_cast works for almost all variable types I tested(int, long, ulong, BOOL, BSTR, LPSTR) but it seems it doesn't work the same way with DOUBLEs.
Am I passing the pointer in a wrong way into the function? I wanna pass the value of 20.95 directly as in the first example above but I need this pointer. Please help.
Thanks for your attention.