V
Vivienne
hi,
I am using visual studio for my c++ project, and have to call a c#
dll. now I met a problem when a methed in c# dll returns null, I
don't know how to use 'null' in c++.
To make it simple, I write a simple example to make my problem clear.
Below is a class A(implemented in c#), the method will return null in
some conditions.
class A{
bool flag;
System::String s;
public System::String getNext(){
if(flag == true)
return s;
else return null;
}
}
in the c++ project , I just want to use the class,like this
A^ a = gcnew A();
if((a->getNext()) != null) //here is the problem, the 'null'
keyword is not defined in c++,
// if I try to use NULL instead
of null, an conversion error will occur.
so, what should I do here?
Thanks!
I am using visual studio for my c++ project, and have to call a c#
dll. now I met a problem when a methed in c# dll returns null, I
don't know how to use 'null' in c++.
To make it simple, I write a simple example to make my problem clear.
Below is a class A(implemented in c#), the method will return null in
some conditions.
class A{
bool flag;
System::String s;
public System::String getNext(){
if(flag == true)
return s;
else return null;
}
}
in the c++ project , I just want to use the class,like this
A^ a = gcnew A();
if((a->getNext()) != null) //here is the problem, the 'null'
keyword is not defined in c++,
// if I try to use NULL instead
of null, an conversion error will occur.
so, what should I do here?
Thanks!