I am using visual studio 2012 with a clr library that needs to link to a native library. My library which is using boost::future.
I am having this problem when I use future::then(F &&) function against the managed project:
Error 910 error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x0100003e). D:\ClrProject\somefile.obj
I tried, as suggested in other questions, to make the dummy
types in the library complete, since I cannot forward declare a nested struct from inside a template, as can be done with boost::thread::dummy
struct.
This did not solve the problem.
My setup is the following:
I am using these very defines on the dependent .dll as well, to make sure that all parts of the API are exposed correctly.
Solved.
@Hans Passant your suggestion was right. I just wasn't putting the #pragma
the correct way.
I had to put the pragmas so that my headers are compiled as unmanaged code. Once that was done, it seems that template instantiations for my code were emitted as unmanaged. At that point, problems disappeared.
So what I did is something like this:
#pragma managed(push, off)
#include "MyHeaderWithFutures.h"
#pragma managed(pop)
void f() {
//
f = myObject.Something().then(...);
}