I am having one project, which is created in VC++6.0 .This project having one exe file and 5 dlls files.
The project is migrate to Visual Studio 2010 from VC++6.0. Now the exe is in C# 2010 and Dlls are in VC++ 2010.
My problem is, I have to access VC++ dll’s class member variables in the C# exe, so for this in VC++ dll’s class, I have added “ref” in the header files.
Below is code snippet of VC++ 2010 dll
Code of ShipInfo.h (header file)
namespace ShipInfoDllNamespace
{
public ref class ShipInfo
{
private:
static float m_fDirection;
}
Code of ShipInfo.cpp (source file)
namespace ShipInfoDllNamespace
{
float ShipInfo::m_fDirection;
}
Now if “ref” is added then I am getting error as –
error C3366: 'ShipInfoDllNamespace::ShipInfo::m_fDirection' : static data members of managed types must be defined within the class definition
-----------------------------------------------------------------------
And if i remove "ref" then NO error, but then i can't access VC++ Dll member variable in C# exe class.
Can anyone advice me how to resolve this issue. Thanks in advance.