With the following class in one c++/cli project:
class __declspec(dllimport) MyClass
{
public:
void Test(std::function<void()> operation)
{
operation();
}
}
And a caller in another c++/cli project:
myClass.Test([](){});
myClass.Test([](){});
myClass.Test([](){});
I get the following error (twice):
LNK2022: metadata operation failed (8013118D) : Inconsistent layout information in duplicated types (std.tr1._Callable_obj<`anonymous namespace'::,0>): (0x02000490).
I do not get the error when calling Test
only twice!
myClass.Test([](){});
myClass.Test([](){});
//COMPILES FINE!
//myClass.Test([](){});
I've tried switching off managed incremental building as per "LNK2022: metadata operation failed" driving me insane. However, the errors still occur.
I'm building in VS2013 but using the Visual Studio 2010 (v100) Platform Toolset.