gcc Fortran External Element Example
gcc Mixed Language DLL with Fortran
This example model shows how to use an External Element to call a DLL to perform calculations outside of GoldSim. The DLL in this case was compiled using the gcc compiler suite from source code which is mainly written in Fortran. The Fortran portion of the source code is compiled using gfortran.
The DLL contains three exposed functions which are C language wrapper functions that call the underlying Fortran subroutines. The gcc compiler suite allows the compilation of code written in different languages to object files using different compiler suite members and then the linkage of these object files (mainly machine language code with some additional metadata for linking) into a single, binary output file. In this example, gcc is used to compile the c language wrapper file and gfortran is used to compile the Fortran language sub-routines and then the compiled object files are linked together into one binary DLL file.