J
Jon Skeet [C# MVP]
I'm just dipping my toes into writing a native DLL and P/Invoking it.
I'd like to pass an array of strings to a function in the DLL, but it's
currently failing. The documentation is somewhat inpenetrable to my
interop-newbie brain - anyone care to enlighten me? I'm trying:
[DllImport("xxx.dll")]
public static extern int yyy(string[] value);
in the C#, and:
extern "C" xxx_API HRESULT yyy(const wchar_t **value);
in the DLL. Passing a string as wchar_t* works fine. Clearly I was
being a tad optimistic trying the above - but is there a simple way of
doing it?
If it's particularly hard, it would work out okay to pass each string
in a separate call, but it's not ideal.
I'd like to pass an array of strings to a function in the DLL, but it's
currently failing. The documentation is somewhat inpenetrable to my
interop-newbie brain - anyone care to enlighten me? I'm trying:
[DllImport("xxx.dll")]
public static extern int yyy(string[] value);
in the C#, and:
extern "C" xxx_API HRESULT yyy(const wchar_t **value);
in the DLL. Passing a string as wchar_t* works fine. Clearly I was
being a tad optimistic trying the above - but is there a simple way of
doing it?
If it's particularly hard, it would work out okay to pass each string
in a separate call, but it's not ideal.