R
Rajesh
Hi All,
I'm having problems marshalling an array of strings between C# and C++
C#
[DllImport"ABC.dll", EntryPoint = "Func",ExactSpelling = false)]
static extern void Func(out IntPtr num, ref IntPtr str);
IntPtr strPtr = IntPtr.Zero;
IntPtr num = IntPtr.Zero;
Func(out num, ref strPtr);
n = num.ToInt64();
C++ signature is
extern "C" __declspec(dllexport) void Func(long &num,BSTR * strings)
When I traced the code, I could see the strings array in C++ populated
correctly. But once in the C# side, I can only access the first string
with Marshal.PtrToStringBSTR(strPtr) I need to know if there is
something basic i'm missing out here. I also tried Marshal.ReadIntPtr(
) to traverse through the IntPtr but that didn't help.
Thanks.
Raj
I'm having problems marshalling an array of strings between C# and C++
C#
[DllImport"ABC.dll", EntryPoint = "Func",ExactSpelling = false)]
static extern void Func(out IntPtr num, ref IntPtr str);
IntPtr strPtr = IntPtr.Zero;
IntPtr num = IntPtr.Zero;
Func(out num, ref strPtr);
n = num.ToInt64();
C++ signature is
extern "C" __declspec(dllexport) void Func(long &num,BSTR * strings)
When I traced the code, I could see the strings array in C++ populated
correctly. But once in the C# side, I can only access the first string
with Marshal.PtrToStringBSTR(strPtr) I need to know if there is
something basic i'm missing out here. I also tried Marshal.ReadIntPtr(
) to traverse through the IntPtr but that didn't help.
Thanks.
Raj