boost::bind and boost::function fail at run-time in managed c++
Compiling the following code with /CLR on, results in an empty function
exception at run-time. If you un-comment the #pragma unmanaged to get
native compilation, it runs fine.
Thanks
Russell
#include "stdafx.h"
#using
I've had a response from the Microsoft groups. The problem is described here http://support.microsoft.com/default.aspx?kbid=823071 I'll post back if I get it working. Thanks Russell Russell Hind wrote:
Compiling the following code with /CLR on, results in an empty function exception at run-time. If you un-comment the #pragma unmanaged to get native compilation, it runs fine.
Thanks
Russell
#include "stdafx.h" #using
//#pragma unmanaged
#include
#include class Test_c { public: void test(void) { } };
int main() { Test_c Test; boost::function
f(boost::bind(&Test_c::test, &Test)); f(); return 0; }
Russell Hind wrote:
I've had a response from the Microsoft groups. The problem is described here
http://support.microsoft.com/default.aspx?kbid=823071
I'll post back if I get it working.
This has worked. I've modified function_base.hpp to be #if defined(_MANAGED) inline int has_empty_target(const function_base* f) { return f->empty(); } inline int has_empty_target(...) { return 0; } #else inline bool has_empty_target(const function_base* f) { return f->empty(); } inline bool has_empty_target(...) { return false; } #endif Not sure if this is the best solution, but it works for now Thanks Russell
participants (1)
-
Russell Hind