[petsc-dev] exporting MPIUNI symbols using PETSC_EXTERN

Satish Balay balay at mcs.anl.gov
Tue Jul 3 14:32:56 CDT 2012


On Tue, 3 Jul 2012, Chetan Jhurani wrote:

> Hi,
> 
> I'm trying to build a Petsc DLL on Windows by making very small
> tweaks to the standard way of configuring/building as far as
> possible.  It is working and I can run some user code using the DLL.
> 
> The problem (which I can avoid locally) is due to non-exported
> petsc MPIUNI global symbols.  For example, functions like the one
> below are not exported because instead of using the macro
> PETSC_EXTERN they use extern.  And PETSC_EXTERN can be expanded to
> __declspec(dllexport) via compile time macros.
> 
> #define MPI_Comm_size     Petsc_MPI_Comm_size
> extern int    MPI_Comm_size(MPI_Comm,int*);
> 
> Since these are called in the user code, they need to be exported.
> One way is to change mpi.h, and the other way is to use a module
> definition file while creating the DLL, which adds the required
> MPIUNI symbols separately.
> 
> Can petsc's default mpi.h be changed to use PETSC_EXTERN instead of
> extern for symbols supposed to be exported?

Well mpiuni/mpi.h does not use petscsys.h so it can't use PETSC_EXTERN.

It will have to use MPIUNI_EXTERN or eqivalent [with some of the
relavent code dupcated from petscsys.h]

Satish



More information about the petsc-dev mailing list