Calling a Delphi DLL from C# produces unexpected results

前端 未结 7 1304
庸人自扰
庸人自扰 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 03:48

    I've never done this but try changing your code to:

    function CreateCode(SerialID : String;
        StartDateOfYear, YearOfStartDate, YearOfEndDate, DatePeriod : Word;
        CodeType,RecordNumber,StartHour,EndHour : Byte) : PChar; stdcall;
        external 'CreateCodeDLL.dll';
    

    Note the extra stdcall.

    Edit2: As you can see from the other replies you either have to do the change above or write a wrapper dll that does the same thing.

提交回复
热议问题