I have a function in a DLL (the c header is):
int my_c_function(
const int cnames[10], const char *delim, size_t delim_size,
char *buffer, size_t *buffersize);
I've tried
function my_c_function(cnames: Array of integer;
const delim : PAnsiChar;
delim_size : integer;
buffer : array of Byte;
BufferSize: integer): integer; cdecl;
implementation
function my_c_function(cnames: Array of integer;
const delim : PAnsiChar;
delim_size : integer;
buffer : array of Byte;
BufferSize: integer): integer; cdecl; external 'mydll.dll';
But it crashes when I try to call the function.
But the following C# import works fine...
[DllImport("mydll.dll", CharSet = CharSet.Ansi,CallingConvention =CallingConvention.Cdecl)]
public static extern int my_c_function(int[] cnames, string delim, int delim_size, StringBuilder buffer, ref int BufferSize);
Any ideas?
Is is the way I need to initialise the Buffer and BufferSize in Delphi?