Creating Fortran Subroutines Callable From Visual Basic
Creating Fortran subroutines that can be called from Visual Basic is in part an art and in part a science. Most of the problems faced by programmers trying to call Fortran procedures from Visual Basic can be traced to one -or a combination- of four issues; failure to create the Fortran DLL with the exported procedures, failure to establish the appropriate calling convention, failure to take into consideration the name-mangling performed by the Fortran compiler to exported subroutines, and lack of understanding of how the compilers handle the different data types passed as arguments. These problems arise, in part, because these issues are not part of any established standard. Each compiler vendor is free to use any calling convention, and the same is true for name-mangling of exported procedures. Understanding these concepts is a first big step towards developing effective mixed language programs. This section first reviews these concepts in general terms, and then goes into the details of how to create Fortran procedures that can be called from Visual Basic using the compilers supported by f90VB.
Compiler-specific details regarding DLLs, calling conventions and name-mangling
Declaring arguments in Fortran procedures callable from Visual Basic and VBA