R
Russell Hind
I'm trying to use boost::bind and boost::function inside managed code,
but there appears to be some code generation problems. The following
code compiles fine, but the function object throws an exception when you
call it with f() saying the function is empty. If you un-comment the
#pragma unamanged, it runs fine. It appears to be a code generation
problem when compiling function and bind as managed.
Thanks
Russell
#include "stdafx.h"
#using <mscorlib.dll>
//#pragma unmanaged
#include <boost/bind.hpp>
#include <boost/function.hpp>
class Test_c
{
public:
void test(void)
{
}
};
int main()
{
Test_c Test;
boost::function<void (void)> f(boost::bind(&Test_c::test, &Test));
f();
return 0;
}
but there appears to be some code generation problems. The following
code compiles fine, but the function object throws an exception when you
call it with f() saying the function is empty. If you un-comment the
#pragma unamanged, it runs fine. It appears to be a code generation
problem when compiling function and bind as managed.
Thanks
Russell
#include "stdafx.h"
#using <mscorlib.dll>
//#pragma unmanaged
#include <boost/bind.hpp>
#include <boost/function.hpp>
class Test_c
{
public:
void test(void)
{
}
};
int main()
{
Test_c Test;
boost::function<void (void)> f(boost::bind(&Test_c::test, &Test));
f();
return 0;
}