Hello,

RE2 - it is "Resident Evil 2" game?

Dmitry Kovalenko.

вт, 20 авг. 2019, 4:27 Adriano dos Santos Fernandes <adrian...@gmail.com>:

> Hi!
>
> When linking optimized static build of re2 with Firebird in Linux, crash
> happens when destroying some RE2 objects.
>
> I have tracked the problem:
> - Firebird (libEngine or executables) defines new/delete operators and
> hides them through version script
> - re2 uses libstdc++ std::string (for example), that uses basic_string
> with default allocator
> - libstdc++ exports basic_string template with default allocator
> - re2 then allocates std::string internal objects with libstdc++ new
> operator
> - re2 object is destroyed and calls Firebird's delete operator
>
> It seems there are three ways to fix the problem:
>
> 1) Link Firebird executables and shared libraries with -static-libstdc++.
>
> 2) Link shared re2 within Firebird. This is what happens with ICU, it
> then calls libstdc++ operator new/delete. But since re2 is C++ library I
> prefer to not do that and always static link the internal version.
>
> 3) Exports new/delete operators in Firebird version scripts. Not sure
> this is good thing and will work always.
>
> For me the better option is (1) and this will also avoid problems when
> installing binaries compiled in different OS versions.
>
> AFAIK Windows also uses dynamic std c++ library and theoretically be
> susceptible to the problem, but at least in basic tests it works.
> However I'm not 100% sure it has no problem.
>
> Comments, please.
>
>
> Adriano
>
>
> Firebird-Devel mailing list, web interface at
> https://lists.sourceforge.net/lists/listinfo/firebird-devel
>
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to