all groups > dotnet interop > july 2006 >
You're in the

dotnet interop

group:

How to marshall a vector<string>


How to marshall a vector<string> SONET
7/24/2006 11:20:02 AM
dotnet interop: I'm a newbie to marshalling, what's the best way to call the following C++
function
from C#?

void foo(const vector<string> name) ?

I've tried doing a

[DllImport("test.dll"), CharSet = CharSet.Ansi)]
public static extern void foo(ArrayList name);

Re: How to marshall a vector<string> Dmytro Lapshyn [MVP]
7/27/2006 2:45:07 PM
Hi,

I don't think there's an easy way to marshal STL template classes. I see
people are having problems even with regular string arrays. You can probably
set out to write a custom marshaler, but it's a LOT of pain IMO. I'd stick
to regular string arrays when doing C++ <-> C# interop.

--
Regards,
Dmytro Lapshyn [MVP]
http://blogs.vbcity.com/DmytroL

[quoted text, click to view]
AddThis Social Bookmark Button