Greetings there. I'm trying to call a .dll built in C from a Delphi application I'm developing.
When declaring the pascal equivalents of the functions in the C .dll exports declaration, I was using "var ... : array of <type>" when the C function asked for a pointer to <type> (an equivalent basic type of record/struct). I realized that lead to big, crashing errors as delphi put an extra element on the stack with the High index of the array.
I know I can sort out the problem by declaring the pascal equivalent as passing a pointer to the first element of the array. However, as the C exported functions in the .dll are custom made for the delphi application, I wanted to know if 1) It would work if I declared a pointer and an unsigned integer as parameters in the C function and an array in the delphi equivalent. 2) If this parameter passing protocol isn't going to change in the future, so it's safe to use.
Thanks for your help in advance.
When declaring the pascal equivalents of the functions in the C .dll exports declaration, I was using "var ... : array of <type>" when the C function asked for a pointer to <type> (an equivalent basic type of record/struct). I realized that lead to big, crashing errors as delphi put an extra element on the stack with the High index of the array.
I know I can sort out the problem by declaring the pascal equivalent as passing a pointer to the first element of the array. However, as the C exported functions in the .dll are custom made for the delphi application, I wanted to know if 1) It would work if I declared a pointer and an unsigned integer as parameters in the C function and an array in the delphi equivalent. 2) If this parameter passing protocol isn't going to change in the future, so it's safe to use.
Thanks for your help in advance.