Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28632 Discussions

Mixed Language Programming: VB/Fortran

kps
Beginner
454 Views
I am working on a project with mixed language programming Visual Basic~Fortran. A .dll file (ZFact.DLL) is created from a Fortran source code with several Subroutines, Functions, and a Block Data group. Each of the Subroutines and Functions (but not the Block Data group) has the ATTRIBUTES Directive with the DLLEXPORT property declared as shown below:

!DEC$ ATTRIBUTES DLLEXPORT :: PARAMDL
!DEC$ ATTRIBUTES DLLEXPORT :: ZDETAIL
? etc.

The VB program declares the Fortran subroutines (in the .dll file) in the `declarations? section of its module as follows:

Declare Sub PARAMDL Lib "C:Program FilesMicrosoft Visual StudioVB98MyProjectsFacorFact.dll" (NCC As Integer, CID() As Integer)

Declare Sub CHARDL Lib "C:Program FilesMicrosoft Visual StudioVB98MyProjectsFacorFact.dll" (NCC As Integer, XI() As Double,ZB As Double, DB As Double)

? etc.

Yet, the VB program executes up to the point it makes the first call to a subroutine in the .dll file and then crashes with the following error message:

Run-time error ?53?:
File not found: C:Program FilesMicrosoft Visual
StudioVB98MyProjectsFacorFact.dll

The .dll file (ZFact.dll) and the corresponding library file (ZFact.lib) are there in the same directory as specified above ? I have checked.

Any ideas or help from any one?

Just in case this has any relationship to the problem ? the call to subroutine in VB and the Subroutine declaration in Fortran along with data type declaration statements are given below:

VB Program:
Call PARAMDL(NCC, CID())
Public CID(1 To 21) As Integer, NCC As Integer

Fortran .dll File:
SUBROUTINE PARAMDL (NCC, CID)
INTEGER NCC, CID(21)

Is the entire array CID being passed on correctly from VB to Fortran?

Thanks!

Krishna Sinha
0 Kudos
1 Reply
Steven_L_Intel1
Employee
454 Views
The "error 53" has nothing to do with the way you're calling the routine - it isn't getting that far. The error message is misleading - it can come up if your DLL depends on other DLLs that are not found. See http://www.compaq.com/fortran/kb/q1023.html for part of the solution, though another thing can be if you build a Debug configuration DLL and take it to a system where CVF isn't installed. The solution there is to build a Release configuration (and install the run-time DLLs as in the article.)

Steve
0 Kudos
Reply