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

Fortran dll called from Visual Basic

David_DiLaura1
New Contributor I
642 Views

Steve (or others):

I'm trying to provide a few subroutines in a dll that can be called from Visual Basic. There have been several posts on this forum on this topic in the past couple of years and I've consulted those to make sure I've put things together correctly. However . . . the VB program keeps giving a "dll not found" error. Careful rechecking shows that the path to the dll in the VB delcare statement is correct, and the dll is in designated folder. The VB program/system is on adifferent machine.

I know the dll is correct since I can call the routines from within this same dll from a Fortran console application I built. The dll doesn't need to be registered, does it?

David DiLaura

0 Kudos
1 Reply
Steven_L_Intel1
Employee
642 Views
No registration needed. Have you looked at the MixedLanguageVB-Calls-Fortran sample provided (10.0 and later) to see a worked example?

Most of the time, this error is caused by a dependent DLL not being in PATH. Download Dependency Walker and have it analyze your DLL to see what it finds. Note that VB will report "DLL not found" for any of a number of errors which may have nothing to do with "finding" the DLL.

My guess is that you do not have the dependent Fortran run-time DLLs on the other machine in a place found on PATH. MSVC DLLs may also be required to be installed. For your purpose, it may make sense to change the Fortran DLL project property Libraries > Use run-time libraries to specify "Multi-Threaded" instead of "Multi-Threaded DLL" so that you are not dependent on run-time DLLs. Thsi is fine as long as there is no Fortran code calling your DLL.
0 Kudos
Reply