By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

How to do the Declare for a Delphi DLL

P: n/a
Hi

I'm trying to interface a foreign DLL that is written in Delphi. I know:
- Delphi-Integer is a 32-Bit signed Integer --> VB: LONG
- Delphi-PChar is a Pointer to Zero-Terminated ASCII String --> I assume
VB: String

The Delphi Declaration looks as follows:
function MP_GetMessageList( HDL : Integer;
var ErrCount : Integer;
var WarnCount : Integer;
var HintCount : Integer;
var ControlCount: Integer;
var StructCount : Integer;
ErrList : PChar): Integer;

Someone has done an Interface for an old version. He declared the
Procedure in VB as follows:
Declare Function MP_GetMessageList Lib "myDll.dll"
(ByVal HDL As Long, _
ByVal ErrCount As Long, _
ByVal WarnCount As Long, _
ByVal HintCount As Long, _
ByVal Controlcount As Long, _
ByVal StructCount As Long, _
ByVal ErrList As String) As Long

1) I wonder: should this not be ByRef instead of ByVal for parameter 2..6?
2) ErrList will return text. I assume I have to define this as fixed
length string like String * 1000
3) There is an other function call. It returns text. Is it correct to
declare it as follows:
Delhpi: function MP_VersionDate(): PChar;
VB: Declare Function MP_VersionAppName Lib "myDll.dll" () As String
4) I assume there is nothing special to consider when the declares the
string, that will have to accept the result
Thanks Walter
Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.