Advice on linking with Fortran?

Bill Baxter wbaxter at gmail.com
Fri Dec 8 12:08:08 PST 2006


I'd like to link with some Fortran math libs on Windows, but there seems 
to be a problem in that there isn't a "dmf" or other Fortran compiler 
that spits out dmd-compatible object files.

coff2omf would work I suppose if I didn't mind shelling out $15.

I have managed to get something working, but the process is a bit 
convoluted.  MinGW can be coaxed to create a dll using a crazy command 
line like

gcc -mno-cygwin -shared -o blaslapack.dll 
-Wl,--out-implib=blaslapack.lib -Wl,--export-all-symbols 
-Wl,--allow-multiple-definition -Wl,--enable-auto-import 
-Wl,--whole-archive liblapack.a libf77blas.a libcblas.a 
-Wl,--no-whole-archive libatlas.a -lg2c

Then you can use implib on the result like:
    implib /system blaslapack.lib blaslapack.dll

To get something which can be used to link with DMD.

But I'd rather not use a DLL for this since BLAS/LAPACK are libraries 
(it comes to 11MB) with tons of things I don't really need.  I probably 
only need a few K of what's in that DLL.  Static linking would make much 
more sense.

Anyone done the Fortran/D thing?  Any advice?
Thanks,
--bb



More information about the Digitalmars-d mailing list