External declaration

Giganews Newsgroups
Subject:External declaration
Posted by: Carlos Saez (csae…@telefonica.net)
Date:Sat, 31 Jul 2010

I have to access a third party DLL from Delphi and since it's the first
time I have to deal with it, I'd like to be sure this is the right way
of doing it. Say the DLL is named Thirdparty.DLL

The specification for one of the functions inside the DLL is:

int FunctionDLL (string P1, string P2, string P3, string ref P4)

I've defined the functions as:

function FunctionDLL(P1:PChar; P2: PChar; P3: PChar; var P4: PChar):
integer;  external 'Thirdparty.dll';

Is that right?.

Although I haven't built an small example yet to check it, in my actual
application calling the function and executing from Delphi (D7) makes
de debugger to raise an AV (Debugger Fault Notification) at the
beginning of the application execution.

Executing it stand alone, the application seems do nothing. If I
comment the sentence, the application runs fine (except for the
commented functionality).

There are some features that perhaps have to be taken into account:

- It has to be registered with: regasm /tlb:'Thirdparty.tlb'
Thirdparty.dll

- It depends on: Interop.CAPICOM.dll

- It depends on: Microsoft.Web.Services3.dll

Thank you

Carlos

--

Replies