Board index » delphi » Reading a DLL written with Delphi 3 from Visual Basic 4.0

Reading a DLL written with Delphi 3 from Visual Basic 4.0

I have written a DLL using Delphi 3. This DLL has to be read from Visual
Basic 4.0.
The DLL exports the following procedure:

procedure Compute( rMin,rMax:integer; v:double; prec:integer;
FileName:pchar); stdcall;

How should I call this procedure from Visual Basic 4.0?

I have tried it using:

Declare Sub Compute Lib "srwin" (ByVal rmin As Integer, ByVal rmax As
Integer, ByVal valor As Double, ByVal prec As Integer, ByVal Name As
string)

The big problem is that the DLL does not receive the correct values.
Neither
the integers. I have tried it passing the values by reference (var in
Delphi and
ByRef in VB) and it doesn't work. I also tried to substitute the 'stdcall'
with
a plain 'exports' with no luck.

Anyone can share his/her experience?

Thanks in advance
o/ Josep Mas

 

Re:Reading a DLL written with Delphi 3 from Visual Basic 4.0


Xci <x...@jet.es> wrote in article <01bc91f9$463824a0$44b4e0c2@p166>...

Quote
> I have written a DLL using Delphi 3. This DLL has to be read from Visual
> Basic 4.0.
> The DLL exports the following procedure:

> procedure Compute( rMin,rMax:integer; v:double; prec:integer;
> FileName:pchar); stdcall;

> How should I call this procedure from Visual Basic 4.0?

> I have tried it using:

> Declare Sub Compute Lib "srwin" (ByVal rmin As Integer, ByVal rmax As
> Integer, ByVal valor As Double, ByVal prec As Integer, ByVal Name As
> string)

I'm taking a stab in the dark here (I'm a VB programmer who's interested in
learning Delphi as a complement to VB, so I don't know a thing about
Delphi's syntax or data types).  Are integers in Delphi 16-bit or 32-bit?
In VB, 'integer' is a 16-bit data type (long is the 32-bit integer type),
so if your Delphi procedure is expecting a 32-bit integer, it's getting a
16-bit from the VB declaration.  I don't know if this is the problem or
not, but what the heck I thought I'd give it a shot.

Good luck.

-Jeff VanBishler (fal...@aa.net)

Other Threads