Your p/invokes are a little off. You need to use CallingConvention.Stdcall
, which is the default. And for the const char*
parameters you should simply declare them to be string
at the C# end.
The correct C# p/invoke for DDC_CreateFile
is:
[DllImport("nilibddc.dll", CharSet=CharSet.Ansi]
private static extern int DDC_CreateFile(
string filePath,
string fileType,
string name,
string description,
string title,
string author,
ref IntPtr file
);
And for DDC_CreateFilePropertyString
you need this:
[DllImport("nilibddc.dll", CharSet=CharSet.Ansi)]
private static extern int DDC_CreateFilePropertyString(
IntPtr file,
string property,
string value
);
If, after fixing your code, you still receive errors when calling these functions, then you are clearly using the library incorrectly. And that's beyond the scope of this question. Consult the documentation, and/or seek support from the library vendor.