Re: [pcre-dev] compile pcre-7.2 on MingW+XP

Startseite
Nachricht löschen
Autor: Philip Hazel
Datum:  
To: andy wang
CC: pcre-dev
Betreff: Re: [pcre-dev] compile pcre-7.2 on MingW+XP
On Fri, 6 Jul 2007, andy wang wrote:

> In order to compile, a minor change need to be done:
> in pcreposix.h
> ....
> #ifdef _WIN32
> #  ifndef PCREPOSIX_STATIC
> #    define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
> #    define PCREPOSIX_EXP_DEFN  __declspec(dllimport)
> #  endif
> #endif
> .....
> As you can see the DECL is declaration so the "dllimport" is right.
> and DEFN is the definition so it should be "dllexport". So after you
> change that line to
> #    define PCREPOSIX_EXP_DEFN  __declspec(dllexport)
> then the compiling should be ok and you can get the DLL and exe on ".libs".


OK, I think I understand this now. The change you have made will work
for compiling the library, but it is wrong to make it that way, because
it will leave it as "export" for applications, who need to import the
functions.

The way this is done for pcre.h is for it to be defined as "export" in
pcre_internal.h, and then not re-defined in pcre.h if it is already
defined. That way, it is "export" while building PCRE, and "import" when
building an application.

I will change things so that they work in the same way for the
pcreposix.h header. (In due course.)

Philip

--
Philip Hazel, University of Cambridge Computing Service.