Calling DLL - Parameters not being sent over?

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.
 
W

Willy Denoyette [MVP]

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

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top