Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling DLL from Delphi 1

Status
Not open for further replies.

halveb

IS-IT--Management
Mar 28, 2004
8
US
I have a DLL that I currently call successfully from a Visual Basic program that I cannot seem to get defined properly in Delphi. I am new to Delphi and I suspect that the different variable types are what are causing my problems. The code declaring the DLL in VB is as follows:

Declare Function utlapi& Lib "PCSUTL32.DLL" (Func&, ByVal DataString$, Length&, RetC&, Xtra1&, Xtra2&)

My code to implement these DLLs in Delphi is as follows:

function utlapi(func:longint; datastring:string; Length, Rcode, Xtra1, Xtra2:longint):longint; external 'PCSUTL32.DLL';

I have tried using different variable types but cannot successfully call this DLL. I get an EAcessViolation error when I attempt to access the exported function utlapi.

I have searched for DLL and read all the posts I could find that may be of help but have found nothing so far that indicates what I am doing wrong with this definition. I don't know what language this DLL was written in but have tried all the various calling methods Delphi has (stdcall, register, cdecl, etc.) to no avail. Any advise or help would be appreciated.

Thank you Bob H.

 
Thanks hilfy I'm off to that site to read up and download the tool. Hope I can figure with that tool. It certainly looks like what I need.
 
Oops, I don't have a header file nor the utilities to create a lib from the DLL. :-( I don't do any C programming other than calling DLLs from VB and now hopefully Delphi.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top