Build Petsc DLL's with Visual Studio C++ 2003 compiler

Chetan Jhurani chetan at
Sun Oct 5 14:20:04 CDT 2008

> From: Thuc Bui
> I was able to build Petsc-2.3.3-p15 for the Debug and Release builds using
> your vcproj file albeit having to remove and/or copy several files to
> different locations in the build directory tree.

I guess this is because of structural differences between 2.3.3-p15 and 2.3.2-p7.

> When I got to the ReleaseDLL build, I had to edit several header files to
> add to the function and variable declarations with PETSCMAT_DLLEXPORT,
> PETSCVEC_DLLEXPORT, etc. to get the codes compiled. Unfortunately, when time
> to link, the compiler wants the file petsc.def. I believe this file is the
> Visual Studio DLL interface file, and it is specified in the vcproj for the
> ReleaseDLL and DebugDLL configurations. By any chance do you have this file
> available?

My mistake.  You don't need it.  Just remove the petsc.def entry from
Project Properties -> Linker -> Input (for both ReleaseDLL and DebugDLL)
and it should link fine.

That file is not really needed to link since exports are done via compile time
declarations.  I had a default petsc.def file in my source tree when I was
testing symbol exports and hence it worked here.


More information about the petsc-users mailing list