When I try to migrate my C# code to Delphi, I found that when using the array as a parameter, it will always raise a "stack damaged" failure. Even use the example code shown here. After many times trying, I finally realized that it's caused by the calling conversion. Now I fixed this problem by using "cdecl" other than "stdcall" like almost others said.
So ,is anybody aware of this thing? May my approaching be a help hand for you .