I know that it is a Delphi function. But I don't know its result, if you use
Unicode. I assume it returns the number of characters. So if you allocate the memory you have to double the result of Length.
And there is still the error with the calling convention in your code. Before you try something else correct it. The calling convention for the function in the
DLL is stdcall, but in your program it is external!