Cannot marshal ‘parameter #1’: Generic types cannot be marshaled

  .net-core, c++, dllimport

I try to call c++ Dll into c# using DLLImport Attribute.
I try to call function that return Dictionary<string,string> but throws error Cannot marshal ‘parameter #1’: Generic types cannot be marshaled.

[DllImport("my.dll",CallingConvention = CallingConvention.Cdecl)]

static extern Int32 getdata(out Dictionary<string,string> keyvalue);

this works fine in python like this but in c# not works.

data = c_char_p()
self.libc.getdata(byref(data), None)

How to resolve this issue ?? Please Help thanks in Advance…

Source: Windows Questions C++

LEAVE A COMMENT