The NAG Fortran and C Numerical Libraries are both available as Dynamic Link Libraries (DLLs) for use on Windows systems. These pages explain how the Fortran based DLLs are easily called from a variety of applications such as Excel & VBA, Visual Basic (VB), Microsoft C++, Fortran 77 and Fortran 90.
NAG has, historically, found that the majority of its customers call the DLLs from VB, VBA, Fortran or C. If the DLLs are going to be called from VB or VBA, the Fortran-based DLL is normally preferred. VB6 stores its arrays using the same convention as Fortran and therefore the underlying numerical library and VB6 code make a simple match.
All the Fortran DLLs are provided complete with VB 'Declare' statements. These VB instructions introduce the routines to VB and also act as useful templates for the user calling the routines. Fortran and VB have a good one to one matching of types, for example VB6 double corresponds to Fortran DOUBLE PRECISION and VB6 Long corresponds to Fortran's INTEGER. Therefore it is straightforward to call the majority of the Fortran DLL routines from VB6.
VB.NET (or VB7) has a different type match: VB7 Integer corresponds to Fortran INTEGER. Another change is the array strorage which is now by row. To interface correctly with the Fortan DLL the user needs to work with transposed arrays.
For users who prefer to use C, the NAG C Library is also available as a DLL. This library provides users with over 850 routines covering a broad range of numerical and statistical areas. For those requiring an even more extensive library, the NAG Fortran Library with nearly 1700 routines, can be used within C programs. A C Header File interface is provided with the Fortran Library DLLs.
The User's Notes provided with the NAG libraries give examples and explain how to call the DLL routines.