I wrote a function that receives a void *
type argument and the plan that I can pass char*
and int
and in the receiving function I read whatever I expect.
It looks like:
void __declspec(dllexport) void* func(void *);
Next i tried to pass a double
here:
double d = 3.14;
(*funcPtr)( (void *)d );
but got an error:
error: invalid cast from type 'double' to type 'void*'
Then I gone through method to pass double to void argument thread and tried this way:
double d = 3.14;
double *p_d = (double *)d;
(*funcPtr)( (void *)p_d );
But still the same luck:
error: invalid cast from type 'double' to type 'double*'
What am I missing and how to resolve my problem? I thought a solution would be to define several typedef
of function pointers.