Calling a Delphi DLL from C# produces unexpected results

前端 未结 7 1327
庸人自扰
庸人自扰 2021-01-05 03:29

I have a Delphi DLL that I did not write, but need to call from a C# ASP.NET 3.5 app. Here is the function definition I got from the developers:

function Cr         


        
7条回答
  •  醉话见心
    2021-01-05 04:00

    While you are asking them to change the calling convention, you should also ask them to change the first parameter so that it is not a "string". Get them to use a pointer to a (null-terminated) char or widechar array instead. Using Delphi strings as DLL parameters is a bad idea even without the added complexity of trying to achieve cross-language compatibility. In addition the string variable will either contain ASCII or Unicode content depending on which version of Delphi they are using.

提交回复
热议问题