Calling DLL - Parameters not being sent over?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

could someone please help me out, i'm trying to call a Delphi 6.0 custom DLL
from inside of a C# windows project.
i use the following declaration:

[DllImport("calwin.dll", EntryPoint="CalcWindow",
ExactSpelling=false,CallingConvention=CallingConvention.StdCall )]
static extern double CalcWindow(long OrderNum22, long WinNum22);

The problem is that the second parameter WinNum22 is always 0 on the DLL
side? the first parameter is passed ok, but not the second one, what am i
doing wrong?

The delphi 6.0 code is as follows:
function CalcWindow(OrderNum:longint; WinNum: longint): double; stdcall;
Implementation
function CalcWindow(OrderNum:longint; WinNum: longint): double;

in the project source file, i export the dll like this:

exports
CalcWindow name 'CalcWindow';

Thanks.
 
In .NET, a long is 64 bits longint in delphi is 32 bit, so you should pass
int's.

Willy.
 
Back
Top