How do i marshal list<int>?
c#, c++, marshalling
Solution
Per Jared Par:
Generics as a rule are not supported in any interop scenario. Both PInvoke and COM Interop will fail if you attempt to Marshal a generic type or value. Hence I would expect Marshal.SizeOf to be untested or unsupported for this scenario as it is a Marshal specific function.
See: Marshalling .NET generic types
Problem
I have a dll in c++, it returns list, I want to use it in my c# app as List ``` [DllImport("TaskLib.dll", SetLastError = true, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] public static extern List<int> GetProcessesID(); public static List<int> GetID() { List<int> processes = GetProcessesID();//It is impossible to pack a "return value": The basic types can not be packed //... } ```