Search code examples
dllblasg77

Linking libblas.dll with g77.exe


I downloaded libblas.dll win32 version, "Prebuilt dynamic libraries using Mingw" from https://icl.cs.utk.edu/lapack-for-windows/lapack/#libraries and used a g77 blas sample "blas3_d_prb.f" from http://people.sc.fsu.edu/~jburkardt/f77_src/blas3_d/blas3_d.html with my g77 compiler, I already tried by converting "libblas.lib" to "libblas.a" with reimp and pexports etc.... but unsuccessful.

I hope anybody have some experience with using libblas.dll with g77(because linking the dll with g77 is seems to be tricky), I also want to confirm calling convention used by "libblas.dll" std or cdecl(what g77 follows)?

Thanks.


Solution

  • I finally determined the problems compiling this particular fortran blas program: Actuallly you need sources (for blas0.f and blas3_d.f) not the libblas.dll(Since it is unknown which sources they used)

    1. Blas0.f also required for auxiliary functions used e.g. r8mat_test, r8mat_print etc.
    2. Compile each library i.e. blas0.f and blas3_d.f to object file with this command: g77 -c blas0.f g77 -c blas3_d.f This will produce blas0.o, and blas3_d.o object files then you will compile main prog like this: (PS: Replace trime functs in blas3_d_prf.f with len_trim) G77.EXE blas3_d_prf.f blas0.o blas3_d.o -o yourblas.exe

    It will generate yourblas.exe binary for windows.