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

Pàgina inicial
Delete this message
Autor: andy wang
Data:  
A: pcre-dev
Assumpte: Re: [pcre-dev] compile pcre-7.2 on MingW+XP
Hi, Philip

> > I have a question about the following macros in pcreposix.h
> > After the changes,  the following two lines look like this:
> > #    define PCREPOSIX_EXP_DECL extern __declspec(dllimport)
> > #    define PCREPOSIX_EXP_DEFN  __declspec(dllexport)

>
> Yes. They are wrong. It should be done the way it is done in pcre.h,
> which is like this:
>

Now I understood, thanks :-).

and from your explanation I also found the reason for the static
linkage problem:
the __imp__pcre_fullinfo in libpcrecpp.a is showed because when
building pcrecpp.cc includes the "pcre.h" in libpcrecpp.h, so for
libpcrecpp.a it is just like App to libpcre.a, so the pcre_fullinfo
etc is the "import" symbols.

After adding the "pcre_internal.h" in libpcrecpp.cc I can now make
static linkage to App.

+// #define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */
+#include "pcre_internal.h"
#include <pcre.h>
#include "pcre_stringpiece.h"
#include "pcrecpp.h"

(besides, I also found that PCRE_DEFINITION no longer existed. So even
I commented that, it works fine for both dynamic and static linkage.)

another thing is when linking with the static library, the orders for
library is important:
g++ testcpp.cc -I. .libs/libpcrecpp.a .libs/libpcre.a is OK while
g++ testcpp.cc -I. .libs/libpcre.a .libs/libpcrecpp.a will fail :-(

Regards,
Andy