I have a native callback function in C++, let\'s say something like this:
void ::CallbackFunction(void)
{
// Do nothing
}
Now I have another
The native part was set up wrong:
void ::SomeNativeFunction(void)
{
m_callback = std::tr1::bind(&::CallbackFunction, m_Tcy); // save in m_callback | m_Tcy is the class where CallbackFunction exists
//this won't work
m_Tcy->SomeManagedFunction(m_callback);
}
This worked for me:
void ::SomeNativeFunction(void)
{
m_callback = std::tr1::bind(&::CallbackFunction, m_Tcy); // save in m_callback | m_Tcy is the class where CallbackFunction exists
//this works, even tho the debugger dies on me when I try to debug this
m_Tcy->SomeManagedFunction(&m_callback);
}
The callback stuff works, but still getting a error in the native main though:
First-chance exception at 0x00007ffb2b59dd60 in *.exe: 0xC0000005: Access violation at location 0x00007ffb2b59dd60.
Unhandled exception at 0x00007ffb2b59dd60 in *.exe: 0xC000041D: Exception during a user callback.
Also, my visual studio 2010 crashes when debugging the callback (in my C++/CLI wrapper). If I wait long enough, it throws the following exceptions:
Access violation reading location 0xfffffffffffffff8.