M
mirek
Hi,
I'm trying to import my old code to the .NET using managed wrappers.
I've read "Managed Extensions for C++ Migration Guide" document and was
trying to do what it stated in it. For example if my function takes
mfc's CString I was converting it this way:
char __pin* szUser =
static_cast<char*>(Marshal::StringToHGlobalAnsi(sUser).ToPointer());
and pass szUser to the function.
Today I've found that I can easily pass *String to the function that
takes CString and it works! I'm now little confused, could someone
explain it? When I have to marshal arguments, when i don't? I thought I
have to marshal all arguments.
The second question: what about marshaling and return values? I mean
marshaling value from the return statement in unmanaged function.
Regards,
mirek
I'm trying to import my old code to the .NET using managed wrappers.
I've read "Managed Extensions for C++ Migration Guide" document and was
trying to do what it stated in it. For example if my function takes
mfc's CString I was converting it this way:
char __pin* szUser =
static_cast<char*>(Marshal::StringToHGlobalAnsi(sUser).ToPointer());
and pass szUser to the function.
Today I've found that I can easily pass *String to the function that
takes CString and it works! I'm now little confused, could someone
explain it? When I have to marshal arguments, when i don't? I thought I
have to marshal all arguments.
The second question: what about marshaling and return values? I mean
marshaling value from the return statement in unmanaged function.
Regards,
mirek