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

Chetan Jhurani chetan at ices.utexas.edu
Fri Oct 3 01:21:15 CDT 2008


On Thu, 2 Oct 2008, Satish Balay wrote:
> On Thu, 2 Oct 2008, Thuc Bui wrote:
> 
> > I attempt to build Petsc DLL libraries with configure.py using first with
> > the option --with-shared=1, which is ignored as indicated in configure.log,
> > and with --with-dynamic=1, which the script crashes.
> > 
> > Is it possible to build Petsc DLL's? Does any one know how to do this? I
> > would like to reduce the size of my executables since I have several using
> > Petsc, and each of them is now huge comparing with that use the "old"
> > Sparskit solver.
> 
> Sorry - currently we don't have a mechanism to build dlls on
> windows. So the above options [shared and dynamic] don't work on
> windows.


I have created a set of visual studio project/solution files.  They've been
tried with petsc-2.3.2-p7.  There are 4 configurations -- Debug, Release,
DebugDLL, and ReleaseDLL.  The first two create a static lib, and the last
two create a DLL (one output file per config).

This results in a petsc.dll of size 3 MB in release mode. Debug mode is 8.5 MB.

You can get them here - http://www.ices.utexas.edu/~chetan/petsc/

Place the files in petsc-2.3.2-p7/src directory. Run petsc config script,
rename the $config directories in bmake directory to appropriate name (Debug,
Release, DebugDLL, ReleaseDLL).  You'll have to run petsc configure ONCE and
copy directories.  Change PETSC_ARCH_NAME and PETSC_NAME in petscconf.h
in each directory. Preprocessor macros like PETSC_DLL_EXPORT are defined
in the vcproj file.

Warnings:

- I'm sure I've missed some steps that I no longer remember.
- Not all the files in petsc/src are compiled. Most are.
- The output (objs, libs, dlls) go into non-standard directories, so change them.
- Some env variables, like $(MPI_DIR), are used in include/link paths.
- blas.lib and lapack.lib are assumed to exist in link path.

Chetan





More information about the petsc-users mailing list