Kwacks

Hello,

I have an umanaged DLL which exposes several functions which I want to call from C#. However, I'm having difficulty creating the struct which I'll call in C#.

The Functions signature is similar to:

HRESULT DoASpecificAction( const std::vector<std::wstring>&FirstParam, const std::vector<std::wstring>&SecondParam, std::vector<MyCustomNamespace::MyCustomClass>&ThirdParam)

What would a struct in C# for the above function look like The conversion appears to be fairly complex as well, maybe using a list will solve the problem. Any ideas

Thanks.



Re: Visual C# Language Data conversion when using DLLImport

Mattias Sjogren

You'll have to write a C++ wrapper that exposes functions with more language neutral parameter types (such as a string array instead of the std::vector). In general it's bad practice to expose language library specific types across module boundaries like this. It's not supported by other languages and doesn't even necessarily work across different versions of the C++ library.