[petsc-dev] exporting MPIUNI symbols using PETSC_EXTERN

Chetan Jhurani chetan.jhurani at gmail.com
Tue Jul 3 14:46:23 CDT 2012



> -----Original Message-----
> From: petsc-dev-bounces at mcs.anl.gov [mailto:petsc-dev-bounces at mcs.anl.gov] On Behalf Of Satish Balay
> Sent: Tuesday, July 03, 2012 12:33 PM
> To: For users of the development version of PETSc
> Subject: Re: [petsc-dev] exporting MPIUNI symbols using PETSC_EXTERN
> 
> 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]

Ah, didn't know that.  I had used to module definition file
route to avoid a full rebuild rather than messing with the header.

Thanks,

Chetan

> Satish




More information about the petsc-dev mailing list