Board index » delphi » C language DLL call from Delphi

C language DLL call from Delphi

Hi,

We try to use Tandem Remote Server Call (RSC) from Delphi 1.0. RSC
contains C-language DLL. One parameter in a function call is a pointer
to the variable that receives the connection
handle(*pulConnectionHandle).

C-language function is    UINT RscConnect ( ULONG ulOptionHandle, UINT
uWaitOption, ULONG *pulConnectionHandle);  

How do we declare Delphi fuction call correctly. We have tried all we
know, but we always get GPF.

We have used FTP4W.dll with Delhi successfully and we belive to be
able to define evrything else correctly exept this pointer
declaration.

We apreciate you help!

Mauri Kantola,  mau...@teknos.fi

 

Re:C language DLL call from Delphi


Quote
> C-language function is    UINT RscConnect ( ULONG ulOptionHandle, UINT
> uWaitOption, ULONG *pulConnectionHandle);

> How do we declare Delphi fuction call correctly. We have tried all we

Just a guess:

type
  pULONG = ^Cardinal;
  TFunc = function (ulOptionHandle: Cardinal; uWaitOption: UINT;
pulConnectionHandle: pULONG): UINT;

-Timo

Re:C language DLL call from Delphi


Don't forget that you need to also specify calling conventions.
By default, C and Delphi use quite different conventions for
passing parameters. If you don't agree on the same convention,
you'll crash everytime you try to call something in the other
language.

David

Quote
Timo Romppanen wrote:

> > C-language function is    UINT RscConnect ( ULONG ulOptionHandle, UINT
> > uWaitOption, ULONG *pulConnectionHandle);

> > How do we declare Delphi fuction call correctly. We have tried all we

> Just a guess:

> type
>   pULONG = ^Cardinal;
>   TFunc = function (ulOptionHandle: Cardinal; uWaitOption: UINT;
> pulConnectionHandle: pULONG): UINT;

> -Timo

Other Threads