HELP : visual basic calling fortran DLL 
Author Message
 HELP : visual basic calling fortran DLL

I want to create user interfaces to my fortran (Microsoft POWERSTATION
4.0) routines in Visual Basic 5.0. So, I compiled my fortran code as a
.DLL which I called from Visual Basic.
While running the visual basic project, a error message appears telling
that
the entry name of the DLL that I called can not be found.
(even if I wrote the right path and the right filename in VB)

Please could anyone give me some pieces of information to help me in
solving this problem ?


Thank you in advance.

Sincerely,

H. Caquineau



Wed, 18 Jun 1902 08:00:00 GMT  
 HELP : visual basic calling fortran DLL

We are currently doing exactly what you are talking about.? It's a little
more involved than simply creating the .DLL and calling it from the VB
application.

The DLL must contain an "entry point" from the VB app.? Example:

??? SUBROUTINE VBTEST (ABC, DEF, GHI)
??? !DEC$ATTRIBUTES DLLEXPORT :: VBTEST
??? !DEC$ATTRIBUTES ALIAS: 'VBTEST' :: VBTEST
??? !DEC$ATTRIBUTES STDCALL :: VBTEST
??? !DEC$ATTRIBUTES REFERENCE :: ABC
??? !DEC$ATTRIBUTES REFERENCE :: DEF
??? !DEC$ATTRIBUTES REFERENCE :: GHI

??? REAL ABC, DEF
??? CHARACTER GHI
??? ...
??? ...

After creating the DLL, you must prototype the entry point in the VB
Module. Example:

??? Dim ABC As Single, DEF As Single, GHI As String

??? Declare Sub VBTEST Lib "[path]\VBTEST.DLL" _
??? (ByRef ABC As Single, ByRef DEF As Single, ByVal GHI As String)
?

Calling the DLL in VB code:

??? Call VBTEST(ABC, DEF, GHI)

NOTE: For arrays, you need only pass the first value.? Also, the argument
lists must contain all values that are being passed to and from the VB app.

I hope this helps.
Keith Whitfield
Hughes-Anderson Heat Exchangers
??

Quote:

> ?
> I want to create user interfaces to my Fortran (Microsoft POWERSTATION
> 4.0) routines in Visual Basic 5.0. So, I compiled my fortran code as a
> .DLL which I called from Visual Basic.
> While running the visual basic project, a error message appears telling
> that
> the entry name of the DLL that I called can not be found.
> (even if I wrote the right path and the right filename in VB)

> Please could anyone give me some pieces of information to help me in
> solving this problem ?


> Thank you in advance.

> Sincerely,

> H. Caquineau

?


Wed, 18 Jun 1902 08:00:00 GMT  
 HELP : visual basic calling fortran DLL

Quote:

> Calling the DLL in VB code:

>     Call VBTEST(ABC, DEF, GHI)

> NOTE: For arrays, you need only pass the first value.  Also, the
> argument lists must contain all values that are being passed to and
> from the VB app.

It is important to send the address of the first element
of the VB array down to the DLL (when calling by reference):

dim a(1 to 10) as single

  call my_dll( a(1) )

If you do the call in the standard VB way:

   call my_dll( a() )

It may not work.

- Matt



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP : Visual Basic calling FORTRAN DLL

2. Creating - Fortran 77 dll for use in Visual Basic 6.0 (not using Compaq Visual Fortran)

3. Calling Fortran DLL in VIsual Basic 6.0

4. Calling fortran dll from visual basic

5. Setting up a MS Fortran .DLL/calling from Visual Basic

6. Calling Fortran 77 dll's from Visual Basic under Excel

7. Visual Basic call a Fortran DLL

8. Calling Fortran-DLLs with Visual Basic 4.0

9. Calling a Visual Basic DLL from a Fortran executable

10. Calling MS Excel Visual Basic functions from Fortran DLL

11. Calling a fortran DLL from Visual Basic

12. compag visual fortran dll callable from visual basic 6

 

 
Powered by phpBB® Forum Software