This is C # code.
namespace CameraTest { class Program { static void Main(string[] args) { string[] lst = new string[10]; for (int i = 0; i < 10; i++) { lst[i] = new string(' ', 33); } bool sync = true; bool ret = CameraCalls.CAM_EnumCameraEx(sync, lst, 10, 33); } } public static class CameraCalls { [DllImport("CamDriver64.dll")] public static extern bool CAM_EnumCameraEx(bool sync, [MarshalAs(UnmanagedType.LPArray)] string[] lst, long maxCam, long maxChar); } }
An unmanaged method is this.
BOOL WINAPI CAM_EnumCameraEx(BOOL bSynchronized, char **ppCameraList, long lMaxCamera, long lMaxCharacter);
The method writes to the passed array of strings. Is there a way to call this method from C # and have unmanaged code to write to an array of strings?
source share