[petsc-dev] Are there both a function AND a #define to retrieve PETSc version?

Eric Chamberland Eric.Chamberland at giref.ulaval.ca
Fri Aug 26 13:53:37 CDT 2016


Hi,

wanting to prevent a possible error: I compile and link (dynamically) my 
code with petsc-3.7.2 BUT I may change my LD_LIBRARY_PATH to point to 
3.7.0...

I would the like my code to stop and tell me I am using the wrong libs...

I could add something like:

if (PETSC_VERSION_MAJOR != PetscInfoVersionMajor() ||
     PETSC_VERSION_MINOR != PetscInfoVersionMinor() ||
     PETSC_VERSION_PATCH != PetscInfoVersionPatch()) {

   printf("You are using a different version of PETSc than the one you 
linked with...");
   exit(1);
}

But I then need non-inlined functions PetscInfoVersion* to have this to 
work...

Does this exists?

I think It could even be into Petsc itself...

Thanks,

Eric





More information about the petsc-dev mailing list