Page 1 of 1

Compiling User defined solver

Posted: 25 Sep 2020, 12:32
by hisham.noaman
Hi All

i am using Elmer and i want to defined a user defined solver, so i just wrote the code in fortran and compile it with the compiler wrapper provided by Elmer, using elmerf90 mysolver.f90 -o mysolver, but the problem is that i want to link another library to the user defined solver. In other program written using Fortran, i just link it when i build the code using cmake, the cmake file as follows

find_package(precice REQUIRED CONFIG)

add_executable(solverdummy solverdummy.f90)

So my preinstalled library precice is linked to the fortran executable, so i want to link the User defined solver with this precice library but i do not have access to the wrapper script to modify it. So how to do that. Thanks in advance.

Hisham

Re: Compiling User defined solver

Posted: 29 Sep 2020, 22:18
by kevinarden
In fortran if you want to compile several programs into one exectuable you list them all

elmerf90 proga.f90 progb.f90 progc.f90 -o myprog

if the other programs(libraries) are compiled objects then provide the compiled object files

elmerf90 proga.f90 -o myprog progb.o progc.o

if they are compiled libraries then

elmerf90 -o output mainprogram.f90 libABC.a