[pcre-dev] [Bug 1357] Insufficient implementation of PCRE_CA…

Page principale
Supprimer ce message
Auteur: Carsten Klein
Date:  
À: pcre-dev
Sujet: [pcre-dev] [Bug 1357] Insufficient implementation of PCRE_CALL_CONVENTION
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=1357




--- Comment #1 from Carsten Klein <cklein05@???> 2013-05-24 10:42:57 ---
Created an attachment (id=628)
--> (http://bugs.exim.org/attachment.cgi?id=628)
Added VB6COMPAT option

Hi there,

I have to come back to that issue with some updates. Actually, exporting the
function pointers to the malloc, free and callout function does not help much
for many WIN32 API compatible languages, like Visual Basic 6 or VBA for
example. It is just impossible (or at least very hard) to call them or to
assign any other value to them, which may be needed with the callout functions.

So, I decided to add another compile-time option (like VPCOMPAT), called
VB6COMPAT. With that option defined, the following things happen:

1. All malloc and free functions are implemented and exported as true C
functions, which call malloc and free directly (they do not rely on the
LocalPcreXXX functions).

2. There are no global variables for the malloc and free functions.

3. There are still three global function pointers for the callout functions,
however, in pcre.h these are just declared extern and are not exported with
__declspec(dllexport).

4. For these callout function pointers, three types called
pcre[16|32]_callout_fn are declared with a typedef statement in pcre.h. For
me, that is the easiest way to use these functions as argument and return
types of other functions.

5. For maintaining the callout function pointers, new accessor functions
pcre[16|32]_get_callout_fn and pcre[16|32]_set_callout_fn are available
and properly exported.

6. Intended for testing purposes primarily, there are also three new exported
functions pcre[16|32]_invoke_callout_fn available. Obviously, these call the
corresponding callout functions with the specified callout_block pointer and
return -1 as an error, if the corresponding function pointer
pcre[16|32]_callout is NULL.

I will attach a zip file containing my latest versions of both pcre.h and
pcre_globals.c. Please, merge these with the files from my first attachment
'Changed files' accordingly.

At least these two files are actually intended to be a drop-in replacement for
the PCRE code base. I also updated/extended the comments that are present in
these files in order to introduce the new VB6COMPAT option properly.

It would be great, if you could add all these changes and improvements to the
PCRE code base. Thanks in advance.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email