<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">I use the following and it works for me<br><br>master is a fortran code calls PETSc solver<br><br>Waad<br>--- On <b>Tue, 4/21/09, Pierre-Yves Aquilanti <i>&lt;sperif@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Pierre-Yves Aquilanti &lt;sperif@gmail.com&gt;<br>Subject: integrating petsc code into non petsc code<br>To: petsc-users@mcs.anl.gov<br>Date: Tuesday, April 21, 2009, 11:27 AM<br><br><div id="yiv914080232">Hello everyone,<br><br>i'm trying to integrate petsc code into one big software. petsc would act as a solver for the program.<br>The way that i try to integrate my petsc code is like that:<br><br>########################<br>
program myoldnonpetsccode<br><br>use mymodule<br><br>implicit none<br><br>call process_petsc<br><br>end myoldnonpetsccode<br>########################<br>module mymodule<br>implicit none<br><br>
#include "finclude/petsc.h"<br><br>contains<br>subroutine process_petsc<br>call PetscInitialize(PETSC_NULL_CHARACTER,ierr)<br><br>call PetscFinalize(ierr)<br><br>end subroutine process_petsc<br>end module mymodule<br>
###############<br><br><br>The compiler used for petsc, mpich and the non-petsc code is the same (PGI). I'm perfectly making my module file (.mod) for mymodule and object one (.o). This one is inserted into a library file (libtest.a).<br>
When i try to make my binary "myoldnonpetsccode" my compiler tells me during the linking process that there's two undefined reference for 'petscinitialize_' and 'petscfinalize_'. I verified that petsc libraries where included during linking process (with -L/mypathtopetsclib and -lpetsc).<br>
I don't find any answer to this on the internet and documentation.<br><br>Do you have any clue on what would be the problem ?<br><br>Thanks a lot<br><br>Best regards<br><br>PYA<br>
</div></blockquote></td></tr></table><br>