digitalmars.D - Advice on linking with Fortran?
- Bill Baxter (22/22) Dec 08 2006 I'd like to link with some Fortran math libs on Windows, but there seems...
 - Carlos Santander (10/39) Dec 08 2006 I guess you could try Christof Meerwald's OpenWatcom Tools:
 - John Reimer (21/40) Dec 08 2006 ms =
 
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
 Dec 08 2006
Bill Baxter escribió:
 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
I guess you could try Christof Meerwald's OpenWatcom Tools: 
http://cmeerw.org/prog/owtools/
"I am currently working on getting OpenWatcom's tools working with Digital Mars 
C++ to provide an alternative to the already dated Digital Mars tools."
And then use the OpenWatcom Fortran compiler: 
http://www.openwatcom.com/index.php/Main_Page
HTH.
-- 
Carlos Santander Bernal
 Dec 08 2006
On Fri, 08 Dec 2006 12:08:08 -0800, Bill Baxter <wbaxter gmail.com> wrot= e:I'd like to link with some Fortran math libs on Windows, but there see=ms =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.coff2omf is not a reliable conversion utility... since it seems that the= = coff format is not consistent across different versions of MS tools (and= = other compiler vendors, for that matter). I don't think it works most o= f = the time (not from my many attempts a couple years ago, at least). = Relying on coff2omf becomes more discouraging than anyting else.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=3Dblaslapack.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 probabl=y =only need a few K of what's in that DLL. Static linking would make mu=ch =more sense.Can you cut down the library to a minimum of required functions and then= = make a dll? Perhaps that is excessively complicated if the library = coupling is extensive. -JJR
 Dec 08 2006








 
 
 
 Carlos Santander <csantander619 gmail.com> 