I hope not to repeat something already asked..I search around but I haven't found something similar.
I have developed a native sdk which expose some classes and interfaces.
Now, I need to implement a mixed mode DLL which uses this SDK.
But the following code does not compile:
WrapperClass.h
#pragma once
#include <vcclr.h>
#using <mscorlib.dll>
class WrapperClass{
public:
WrapperClass();
private:
gcroot<Client^> m_ManagedObj;
};
NativeClass.h
#pragma once
#include "stdafx.h"
#include "NativeSDK.h"
#include "WrapperClass.h"
class Native : public INativeSDK {
public:
// ... code ...
private:
WrapperClass ManagedObj;
}
The settings are:
Project Setting : No Support for CLR
NativeClass.cpp : No Support for CLR
WrapperClass.cpp : /clr
The compiler error is:
..\include\vcclr.h(16): fatal error C1190: The managed code require an option '/clr'
Because NativeClass is not compiled with /clr.
I suppose I need to use #pragma mananaged/unmanaged directive but I cannot figure out how.
Could someone give me some suggestions?