An IMLPlus program can call external user-defined functions written using the Fortran programming language. Because external user-defined functions are always executed on the client Windows PC, a Fortran function must be compiled and linked for use with the Microsoft Windows operating system before it can be called by IMLPlus. Specifically, the Fortran function must be packaged within, and exported from, a Dynamic-Link Library (DLL). To call the Fortran function, an IMLPlus program uses the DllFunction class.
There are three steps to calling a Fortran function from an IMLPlus program:
To demonstrate each of these steps, the following topics present an example of packaging a Fortran function within a DLL and then calling it from an IMLPlus program:
Packaging a Fortran Function within a DLL
Writing a Wrapper Module to Call the Fortran Function
Calling the Wrapper Module from the Main Program
The example function multiplies a vector by a scalar and returns the product vector. Mathematically, it computes y = c x where x is a vector and c is a scalar.