fix(gql): define ANTLR4CPP_STATIC for Windows builds - #58
Merged
Conversation
antlr4_runtime is built as a static library, but on Windows its headers default to __declspec(dllimport) unless ANTLR4CPP_STATIC is defined. The GQL object libraries compile without that define, so MSVC emits references to a non-existent ANTLR DLL for inline/compiler-generated members such as AbstractParseTreeVisitor::shouldVisitNextChild and its destructor, producing LNK2001. Define ANTLR4CPP_STATIC for the gql extension, matching the core library's own ANTLR consumers (src/CMakeLists.txt).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The GQL extension links
antlr4_runtime, which is built as a static library (seethird_party/antlr4_runtime/CMakeLists.txt). On Windows its headers default to__declspec(dllimport)unlessANTLR4CPP_STATICis defined.The GQL object libraries compile their sources without that define, so MSVC emits references to a non-existent ANTLR DLL for inline/compiler-generated members. This surfaces as:
Fix
Define
ANTLR4CPP_STATICfor the gql extension, so those members are emitted locally in the extension's own TUs. This matches how the core library builds its own ANTLR consumers (src/CMakeLists.txt).Linux/macOS builds are unaffected —
ANTLR4CPP_STATICis only consulted in the MSVC branch ofantlr4-common.h.