[pcre-dev] Fw: [Bug 1830] pcre2posix defines the same names …

Top Page
Delete this message
Author: Ze'ev Atlas
Date:  
To: Pcre Exim
Subject: [pcre-dev] Fw: [Bug 1830] pcre2posix defines the same names as POSIX




HiIn z/OS, I've created a macro

I may compile with
UNDEF(COMPILE_WITH_PCRE2)  or DEF(COMPILE_WITH_PCRE2) 
In the source code:
#ifdef COMPILE_WITH_PCRE2                                          
/* This header contains a few pragma statements to make the compiler
 use the PCRE2 equivalents of the traditional POSIX functions*/    
#include "PC2PSXPG.h"                                              
#include "pcre2.h"                                                 
#include "posixh.h"                                                              
#else                                                                   
#include <regex.h>                                                 
#endif     


The core component is the PC2PSXPG.h header with these pragmas (IBM C compiler):
#pragma map (regfree, "PREGFREE")  
#pragma map (regerror, "PREGERR")  
#pragma map (regexec, "PREGEXEC")  
#pragma map (regcomp, "PREGCOMP")  

In the pcre2posix, I actually have the right hand names (i.e. PREGFREE, PREGERR, etc.) and the compiler substitutes them in compile time, based on the pragma.  Note that the macro allows me to include the appropriate PCRE2 header files.  The version in the PCRE (as opposing to PCRE2) port is incorrect but I plan to drop support to PCRE soon.
The main problem is not so much the compile time but the linkedit.  Native z/OS does not have any form of 'make' and one needs to arrange the order of link libraries by hand, if at all possible.

Any other solution would be a nightmare in that environment.

                                                       
 Ze'ev Atlas

      From: "admin@???" <admin@???>
 To: pcre-dev@??? 
 Sent: Wednesday, May 11, 2016 6:38 AM
 Subject: [pcre-dev] [Bug 1830] pcre2posix defines the same names as POSIX


https://bugs.exim.org/show_bug.cgi?id=1830

--- Comment #2 from Pascal MALAISE <malaise@???> ---
In pcreposix.h (8.38) I see:
PCREPOSIX_EXP_DECL int pcreposix_regcomp(regex_t *, const char *, int);
and further on in the same file:
#define regcomp pcreposix_regcomp
This allows calling regcomp(...) but also ensures that as soon as I include
pcreposix.h I will finally call the pcreposix_regcomp of libpcreposix.

In pcre2posix.h (10.21) I see:
PCRE2POSIX_EXP_DECL int regcomp(regex_t *, const char *, int);
As a consequence, despite I include pcre2posix the main is not linked to
libpcre2-posix. (Note, the main also calls pcre2_config, so it includes pcr2).

The main:
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
#include <pcre2posix.h>
...
res = regcomp (&regex, argv[1], 0);

The linking command: gcc -o tpcre2 lib_Linux/tpcre2.o -lpcre2-posix -lpcre2-8

ldd tpcre2
    linux-vdso.so.1
    libpcre2-8.so.0
    libc.so.6
    libpthread.so.0
    /lib64/ld-linux-x86-64.so.2

Similar code and commands with "old" pcre lead to:
    linux-vdso.so.1
    libpcreposix.so.3
    libpcre.so.3
    libc.so.6
    libpthread.so.0
    /lib64/ld-linux-x86-64.so.2

Maybe the pcreposix_regcomp() and #define regcomp pcreposix_regcomp is an
artifact introduced by the debian packager? I use Ubuntu 16.04.
(In reply to Philip Hazel from comment #1)

--
You are receiving this mail because:
You are on the CC list for the bug.
--
## List details at https://lists.exim.org/mailman/listinfo/pcre-dev