Re: [pcre-dev] More Windows-related/misc. tweaks

Top Pagina
Delete this message
Auteur: Daniel Richard G.
Datum:  
Aan: pcre-dev
Onderwerp: Re: [pcre-dev] More Windows-related/misc. tweaks
On Tue, 2007 Jul 31 15:49:22 +0100, Philip Hazel wrote:
>
> I have applied your patch (I hope correctly, though with some added
> comments and maybe format changes). PCRE itself compiles fine on Linux.
> However, the C++ wrapper doesn't.


I'm afraid a few critical bits were lost in translation. New patch
attached, changes as follows:

==> pcrecpp.h

* Classes need the _DEFN macro, not _DECL. The "extern" keyword is an error
there, and moreover, those really are the class definitions. They're not
elaborated in another file; they are exactly what the header file says
they are.

==> pcrecpp_internal.h

* The _DECL macro needs "extern", for when it is used to declare external
variables.

* Added a helpful comment to the final #endif.

==> pcrecpp.cc

* no_arg is being defined here, not declared.

==> pcreposix.c

* pcre.h needs to be #included before pcre_internal.h so that PCRE_EXP_DECL
and friends are defined as for applications, not as for PCRE internal
use. (pcreposix may make use of some PCRE internals, but it still has to
import symbols from pcre.)

==> dftables.c

* Where did the newlines go? :)

==> pcre_maketables.c

* Preprocessor directives must always have the "#" in column 1.

==> CMakeLists.txt

* Minor tweak, just restoring some tabs that got stripped.


--Daniel


-- 
NAME   = Daniel Richard G.       ##  Remember, skunks       _\|/_  meef?
EMAIL1 = skunk@???        ##  don't smell bad---    (/o|o\) /
EMAIL2 = skunk@???      ##  it's the people who   < (^),>
WWW    = http://www.******.org/  ##  annoy them that do!    /   \
--
(****** = site not yet online)

Index: pcrecpp.h
===================================================================
--- pcrecpp.h    (revision 199)
+++ pcrecpp.h    (working copy)
@@ -355,7 +355,7 @@
 // along with other options we put on top of pcre.
 // Only 9 modifiers, plus match_limit and match_limit_recursion,
 // are supported now.
-class PCRECPP_EXP_DECL RE_Options {
+class PCRECPP_EXP_DEFN RE_Options {
  public:
   // constructor
   RE_Options() : match_limit_(0), match_limit_recursion_(0), all_options_(0) {}
@@ -487,7 +487,7 @@
 // Interface for regular expression matching.  Also corresponds to a
 // pre-compiled regular expression.  An "RE" object is safe for
 // concurrent use by multiple threads.
-class PCRECPP_EXP_DECL RE {
+class PCRECPP_EXP_DEFN RE {
  public:
   // We provide implicit conversions from strings so that users can
   // pass in a string or a "const char*" wherever an "RE" is expected.
Index: pcrecpp_internal.h
===================================================================
--- pcrecpp_internal.h    (revision 199)
+++ pcrecpp_internal.h    (working copy)
@@ -39,12 +39,12 @@
 #      define PCRECPP_EXP_DATA_DEFN
 #    endif
 #  else
-#    define PCRECPP_EXP_DECL
+#    define PCRECPP_EXP_DECL         extern
 #    define PCRECPP_EXP_DEFN
 #    define PCRECPP_EXP_DATA_DEFN
 #  endif
 #endif


-#endif
+#endif /* PCRECPP_INTERNAL_H */

 /* End of pcrecpp_internal.h */
Index: pcrecpp.cc
===================================================================
--- pcrecpp.cc    (revision 199)
+++ pcrecpp.cc    (working copy)
@@ -55,7 +55,7 @@
 static const int kVecSize = (1 + kMaxArgs) * 3;  // results + PCRE workspace


// Special object that stands-in for no argument
-PCRECPP_EXP_DECL Arg no_arg((void*)NULL);
+PCRECPP_EXP_DEFN Arg no_arg((void*)NULL);

 // If a regular expression has no error, its error_ field points here
 static const string empty_string;
Index: pcreposix.c
===================================================================
--- pcreposix.c    (revision 199)
+++ pcreposix.c    (working copy)
@@ -57,6 +57,7 @@
 #  define PCREPOSIX_EXP_DEFN __declspec(dllexport)
 #endif


+#include <pcre.h>
#include "pcre_internal.h"
#include "pcreposix.h"

Index: dftables.c
===================================================================
--- dftables.c    (revision 199)
+++ dftables.c    (working copy)
@@ -109,9 +109,9 @@
   "Pulling in the header ensures that the array gets flagged as \"someone\n"
   "outside this compilation unit might reference this\" and so it will always\n"
   "be supplied to the linker. */\n\n"
-  "#ifdef HAVE_CONFIG_H"
-  "#include <config.h>"
-  "#endif"
+  "#ifdef HAVE_CONFIG_H\n"
+  "#include <config.h>\n"
+  "#endif\n\n"
   "#include \"pcre_internal.h\"\n\n");
 fprintf(f,
   "const unsigned char _pcre_default_tables[] = {\n\n"
Index: pcre_maketables.c
===================================================================
--- pcre_maketables.c    (revision 199)
+++ pcre_maketables.c    (working copy)
@@ -45,10 +45,10 @@



 #ifndef DFTABLES
-  #ifdef HAVE_CONFIG_H                         
-  #include <config.h>
-  #endif                                                               
-  #include "pcre_internal.h"
+#ifdef HAVE_CONFIG_H                         
+#include <config.h>
+#endif                                                               
+#include "pcre_internal.h"
 #endif



Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt    (revision 199)
+++ CMakeLists.txt    (working copy)
@@ -316,10 +316,10 @@
 FILE(GLOB man3 ${CMAKE_SOURCE_DIR}/doc/*.3)


 IF(PCRE_BUILD_PCRECPP)
-        INSTALL(TARGETS pcrecpp
-                RUNTIME DESTINATION bin
-                LIBRARY DESTINATION lib
-                ARCHIVE DESTINATION lib)
+    INSTALL(TARGETS pcrecpp
+            RUNTIME DESTINATION bin
+            LIBRARY DESTINATION lib
+            ARCHIVE DESTINATION lib)
     INSTALL(FILES ${PCRECPP_HEADERS} DESTINATION include)
 ELSE(PCRE_BUILD_PCRECPP)
     # Remove pcrecpp.3