Firstly, I am not a programmer by trade and have no formal experience or schooling in it.
For my Msc thesis I have to use LAPACK in order to solve a system of linear equations in fortran. I am not familiar with building LAPACK myself but found there are prebuild libraries which I can, according to this thread use directly. I have downloaded the 32 bit and 64 bit dll's liblapack.dll from here, and placed them in the same directory as my fortran code. I have renamed them lapack32.dll and lapack64.dll respectively - I am unsure how to check if I have 32 bits or a 64 bits compiler.
A test code testinv.f90, taken from the aforementioned forum thread is used to verify installation:
Program LinearEquations
! solving the matrix equation A*x=b using LAPACK
Implicit none
! declarations
double precision :: A(3,3), b(3)
integer :: i, pivot(3), ok
! Say we are alive:
print*, 'Hi this is working!'
! matrix A
A(1,:)=(/3, 1, 3/)
A(2,:)=(/1, 5, 9/)
A(3,:)=(/2, 6, 5/)
! vector b
b(:)=(/-1, 3, -3/)
! find the solution using the LAPACK routine DGESV
call DGESV(3, 1, A, 3, pivot, b, 3, ok)
! print the solution x
do i=1,3
write(*,9) i, b(i)
end do
9 format('x[', i1, ']= ', f5.2)
end program LinearEquations
The expected results of this program are that the line 'Hi, this is working!' and the solution (3 values) to the linear system are printed to the terminal.
Compilation was done using the following, for 32 and 64 bits:
64 Bit: gfortran -o testinv testinv.f90 -L. lapack64.dll; ./testinv.exe
Here the compiler spits out an error about not recognising lapack64.dll: lapack64.dll: file not recognized: file format not recognized collect2.exe: error: ld returned 1 exit status
32 Bit: gfortran -o testinv testinv.f90 -L. lapack64.dll; ./testinv.exe
This does actually compile and produce testinv.exe (size 49 kb), but running this, produces not a single result (nothing is printed to the terminal).
Is the way I am trying to get LAPACK to run from fortran a valid one? Or am I missing something? I appreciate any help and patience.