Reputation: 2175
I have a Fortran
library that uses a lot of modules. I use the ifort
compiler on Windows. Therefore, I get a *.lib
file for the library and *.mod
files for the used modules.
This has the disadvantage that I also have to distribute the *.mod
files, if I want to use the compiled library in another programme. How can this be prevented? I see two possibilities:
bind(c)
in function definitions. Then I can distribute the library with a c-like header file.Are there any other possibilities? What are best practices to distribute a compiled fortran library that uses modules?
Upvotes: 2
Views: 808
Reputation: 60008
I think that to distribute also the .mod
file is the easiest, by far, if it supposed to by used called from Fortran. If it is to be called from other languages, you need the C interface anyway.
The bad thing is loosing the Fortran explicit interfaces. With option number 1 you can probably still have it, if you supply an include file with interface blocks, but just supplying the .mod
file is better IMHO.
Upvotes: 1