RFR: 8311661: Resolve duplicate symbol of StringTable::StringTable with JDK static linking [v2]

Jiangli Zhou jiangli at openjdk.org
Tue Jul 11 16:49:12 UTC 2023


On Tue, 11 Jul 2023 16:19:40 GMT, Ioi Lam <iklam at openjdk.org> wrote:

> > Hi,
> > to prevent clashes like this, libraries that support static linking tend to define a global namespace or a common prefix, usually switchable via defines. IIRC sqlite does this, zlib, jemalloc... If we could pull such a thing off with a minimum of invasiveness, it would be a much more robust solution.
> 
> Do the libraries that you mention just enclose every .cpp and .hpp files with `namespace xxx {` and `}`.

Both zlib and jemalloc achieve name space isolations via #define, although not in C++ namespace definition. I think that's what @tstuefe was referring to.

>
> Something like
>
> // thread.hpp
> #include <....>
> #include <....>
> #include <....>

> namespace hotspot {   // <<< add
> class Thread {....}
> } // <<< add
> That doesn't look too bad to me, as we just need to do this once, and it can (probably) be done with a script.

Global namespace (as @JornVernee has suggested) does sound attractive as long as we can do it without very invasive changes. It's also a more future-proof solution. I'll do some exploration as well.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14808#issuecomment-1631156523


More information about the graal-dev mailing list