P
Patrik via DotNetMonster.com
Hi,
I have simple managed C++ lib library with variable declaration of type
CString.
Another C# windows application reference this C++ library.
When I try call method in C++ library from C#, line with CString
declaration throw an NullReference exception 'Object reference not set to
an instance of an object.' in file atlsimpstr.h at line "CStringData* pData
= pStringMgr->GetNilString();".
But if I try call this C++ method from managed C++ console application,
everything is ok.
Can anyone explain me, what I'm doing wrong ?
managed C++ library:
#pragma once
#include <atlstr.h>
#include "stdafx.h"
using namespace System;
namespace CppLib
{
public __gc class Class1
{
public:
Class1(void)
{
}
~Class1(void)
{
}
void DoAction()
{
CString s("abc"); //this line throw NullReference exception 'Object
reference not set to an instance of an object.'
}
};
}
C# method:
private void button1_Click(object sender, System.EventArgs e)
{
CppLib.Class1 c = new CppLib.Class1();
c.DoAction();
}
thanx for any ideas..
pm
I have simple managed C++ lib library with variable declaration of type
CString.
Another C# windows application reference this C++ library.
When I try call method in C++ library from C#, line with CString
declaration throw an NullReference exception 'Object reference not set to
an instance of an object.' in file atlsimpstr.h at line "CStringData* pData
= pStringMgr->GetNilString();".
But if I try call this C++ method from managed C++ console application,
everything is ok.
Can anyone explain me, what I'm doing wrong ?
managed C++ library:
#pragma once
#include <atlstr.h>
#include "stdafx.h"
using namespace System;
namespace CppLib
{
public __gc class Class1
{
public:
Class1(void)
{
}
~Class1(void)
{
}
void DoAction()
{
CString s("abc"); //this line throw NullReference exception 'Object
reference not set to an instance of an object.'
}
};
}
C# method:
private void button1_Click(object sender, System.EventArgs e)
{
CppLib.Class1 c = new CppLib.Class1();
c.DoAction();
}
thanx for any ideas..
pm