I have a DLL file that is written in C. I tried to use it in managed code but some how my function is not working properly. Here is the C code.
int preProcessImagesC (char *p_trainingFilePath,
char **p_vecImageFilesOrDirs);
This function is working fine.
Managed code :
unsafe private static extern int preProcessImagesC(
//Works perfact
String p_trainingFilePath,
//char** thise parameter is taking junk values , String Array is not working
[MarshalAs(UnmanagedType.SafeArray)] ref String[] p_vecImageFilesOrDirs);
Only first parameter is working properly. What should I use for char **p_vecImageFilesOrDirs parameter in managed code. Please help me to write compatible code in C#.
p_vecImageFilesOrDirs? Is it an array of strings, passed in to the native code? Or is is a pointer to string, passed by reference, to allow the native code to return a single string to the caller? Or is it something else? Likewise what isp_trainingFilePath? In or out? And what about calling convention? Where do you specify that? And why use unsafe? Finally, please format the code. The code looks like it has just been puked in there! Lay it out neatly.