So I am trying to address this warning: nonstandard conversion between pointer to function and pointer to data I haven’t been able to figure out a good way to do this. This is all done in c and not c++.
Currently I have a header file with:
typdef struct myConnection_s
{
...
void* Callback
} myConnection_t, *Connection
typdef HRESULT (*HttpHook)(Connection, char*);
In other files foo.c I have:
....
Connection myConnection;
...
HttpHook myHook = (HttpHook) myConnection->Callback;
...
return myHook(.....);
Is there a good way to fix this warning without having to change too much? If not what would be the best way to rewrite this?
Thanks!
You can also then drop the explicit cast later on:
Edit: Looks like you have an ordering problem… try this: