Open ezra-varady opened 10 months ago
It seems the reason for namespace std::
always being visible is that various C++ language features require this to work properly across shared library boundaries. Since lantern will never be linked against, and postgres, as well as the extension itself are both written in pure C, I believe for our specific use case it's safe to hide these symbols. I think the C++ components should have the correct symbols available when they're linked into usearch, and because usearch will, in this case, only ever be called by pure C, we can safely throw out the symbols. Nothing from inside usearch will ever interact with a C++ runtime outside of the library. The descriptions I've found are terse and ambiguous though. I'll try to figure out how to trigger an exception in usearch to sanity check this
I changed the version name to LANTERN_V1
. Since nothing actually links against lantern, we shouldn't have to have multiple ABI versions, but in case we do this name will be safe
This attempts to address #202. It adds a cmake target for an
ld
version script that places all symbols not explicitly marked withPGDLL_EXPORT
in thelocal
section. It finds the functions that need to be marked as global automatically so it shouldn't require developers to mark their functions in a suppression script. I believe that--version-script
should behave the same way inlld
though there isn't any documentation so this may only work with gnu tools. I would have preferred to set all visibility to hidden then manually mark functions to be exported in source since this is more transparent to developers, however libstdc++ doesn't allow thisexample symbol exports with suppression script
EDIT: apparently Darwin uses its own linker so this isn't compatible with osx builds. Since this will be a relatively small percentage of deployments long term I think it's acceptable to just export more symbols on mac
EDIT2: sanitizer failure is unrelated to changes. It passed on the previous run, seems there's some minor non-determinism in the index that fails in that test