Thread overview | |||||
---|---|---|---|---|---|
|
December 08, 2006 Advice on linking with Fortran? | ||||
---|---|---|---|---|
| ||||
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 |
December 08, 2006 Re: Advice on linking with Fortran? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | 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 |
December 09, 2006 Re: Advice on linking with Fortran? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bill Baxter | On Fri, 08 Dec 2006 12:08:08 -0800, Bill Baxter <wbaxter@gmail.com> wrote: > 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. 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 of 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=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. 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 |
Copyright © 1999-2021 by the D Language Foundation