Need HELP with Delphi DLL to be Called by VB 5.0 
Author Message
 Need HELP with Delphi DLL to be Called by VB 5.0

I am trying to develop a DLL in delphi 2.0 that I can call from Visual
Basic 5.0.  I can successfully call the DLL from Delphi, but when I try
to call it from VB 5.0 I get an error message that "the function TSAT
does not exist in the file PSATDLL1".  A simplified example is shown
below.  I appreciate any help that can be sent my way on this one.

Has anyone had success in doing this?

***************************
The Delphi 2.0 DLL starts here.
***************************

{f+}
library dll10;

uses
  windows,
  stdctrls,

    FUNCTION TSAT(P_X: double):double;  far; export; stdcall;

    BEGIN
         TSAT := 2*P_X;
    END;

    exports


BEGIN

END.

*************************************
The VB 5.0 Calling Program starts here.
***********************************
Option Explicit
Private Declare Function TSAT Lib "PSATDLL1.dll" (ByVal PX As Double) As
Double
Private Sub Command1_Click()
Dim TX, PX As Double
PX = 20.0
TX = TSAT(TX)
End Sub



Mon, 28 Aug 2000 03:00:00 GMT  
 Need HELP with Delphi DLL to be Called by VB 5.0

Does Delphi have a utility to list DLL exports? I know
Borland C++ does. I'd make sure the name is being exported
exaclty as defined.

Also, *never* return double.

If you check the Windows APIs, none of them return
double or float. There is no standard defined by Microsoft
for returning floats or doubles from DLLs, so (of course),
Microsoft does it one way, Borland does it another.

This guarantees you won't be able to call your DLL from
a Microsoft language.

You can pass in the double as a ByRef argument to
get back your result. Alternatively, you could return
an OLE_VARIANT containing the double.

--
Ron Ruble
Raffles Software Development, Inc.

Quote:

>I am trying to develop a DLL in Delphi 2.0 that I can call from Visual
>Basic 5.0.  I can successfully call the DLL from Delphi, but when I try
>to call it from VB 5.0 I get an error message that "the function TSAT
>does not exist in the file PSATDLL1".  A simplified example is shown
>below.  I appreciate any help that can be sent my way on this one.

>Has anyone had success in doing this?

>***************************
>The Delphi 2.0 DLL starts here.
>***************************

>{f+}
>library dll10;

>uses
>  windows,
>  stdctrls,

>    FUNCTION TSAT(P_X: double):double;  far; export; stdcall;

>    BEGIN
>         TSAT := 2*P_X;
>    END;

>    exports


>BEGIN

>END.

>*************************************
>The VB 5.0 Calling Program starts here.
>***********************************
>Option Explicit
>Private Declare Function TSAT Lib "PSATDLL1.dll" (ByVal PX As Double) As
>Double
>Private Sub Command1_Click()
>Dim TX, PX As Double
>PX = 20.0
>TX = TSAT(TX)
>End Sub



Mon, 28 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB 5.0 calling C++ 5.0 DLL that calls winsock.dll

2. Help: VB Call C or Delphi DLL

3. Problem calling DLL writen in VC 5.0 from VB 5.0

4. VB 5.0 calling C++ 5.0 DLLs

5. VB 5.0 calling C++ 5.0 DLLs

6. Problem calling DLL writen in VC 5.0 from VB 5.0

7. VB 5.0 calling C++ 5.0 DLLs

8. Problem calling DLL writen in VC 5.0 from VB 5.0

9. Problem calling DLL writen in VC 5.0 from VB 5.0

10. I need testers for serial port comm DLL and alpha paging DLL (Delphi, C/C++, VB)

11. Floating Point Speed - Comparison of VB 5.0, Delphi 3.0, and VC 5.0

12. calling delphi dll from vb

 

 
Powered by phpBB® Forum Software