[Solved] Exporting C++ dll to c# [closed]


[DllImport(@"../data/stasm_dll.dll")]
internal static extern void AsmSearchDll
( 
    [Out] out Int32 pnlandmarks,
    [Out] out Int32[] landmarks,
    [In, MarshalAs(UnmanagedType.LPStr)] String image_name,
    [In, MarshalAs(UnmanagedType.LPStr)] String image_data,
    [In] Int32 width,
    [In] Int32 height,
    [In] Int32 is_color,
    [In, MarshalAs(UnmanagedType.LPStr)] String conf_file0,
    [In, MarshalAs(UnmanagedType.LPStr)] String conf_file1
);

IplImage img = cvlib.cvLoadImage(image_name, cvlib.CV_LOAD_IMAGE_COLOR);
String imageData = Marshal.PtrToStringAnsi(img.imageData);

AsmSearchDll(out nlandmarks, out landmarks, image_name, imageData, img.width, img.height, 1, null, null);

You didn’t specified cvPolyLine… so I can’t check arguments. Anyway… you are just passing wrong value types to your method. As simple as this.

9

solved Exporting C++ dll to c# [closed]