String^, LCSTR and NULL

  • Thread starter Thread starter Franz.Jacob
  • Start date Start date
F

Franz.Jacob

Hi NG,

I wonder how to pass NULL pointer of type String^ to function call.

I have a native DLL:

extern "C" long __declspec(dllimport) __stdcall Test(LPCSTR a, LPCSTR
b = 0);

with optional/default parameter b.

Now I define:

#define LPCSTR [MarshalAs(UnmanagedType::LPStr)]String^

To use implicit managed to unmanaged copy of my String^ values.

But how could I use default value (b = 0) with String^ values?

I won't use function Test like this:

String ^a = "a";
String ^b;
Test(a, b);

to use it with b as NULL value.
Instead I would like to use it in this way:

String ^a = "a";
Test(a);

and b should be set (as it should) to NULL or what ever it is calles in
..NET

BTW, b is not the only default/optional value...


regards
Franz
 
Back
Top