Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't use __declspec(dllexport) on windows #3128

Merged
merged 1 commit into from Mar 4, 2024

Conversation

amaanq
Copy link
Member

@amaanq amaanq commented Mar 4, 2024

using this makes every other symbol hidden by default; for whatever reason microsoft exposes every symbol unless __declspec(dllexport) is used, then only those marked with this are exported

Closes #3127

@amaanq amaanq merged commit 304f8b7 into tree-sitter:master Mar 4, 2024
11 of 13 checks passed
@@ -1346,7 +1346,7 @@ impl Generator {
add_line!(self, "#endif");
add_line!(self, "");
add_line!(self, "#ifdef _WIN32");
add_line!(self, "#define TS_PUBLIC __declspec(dllexport)");
add_line!(self, "#define TS_PUBLIC");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this whole TS_PUBLIC thing at all in the generated parsers? I don't remember what issue it solved, and it looks like on non-windows platforms, it just setting visibility to default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's so if anyone decides to compile with -fvisibility=hidden the symbols are still exported anyways. sometimes it's nice to reduce the noise/visible symbols from the lib or parser, which might stem from the enums/symbol names in parser.c.

@lewis6991
Copy link
Contributor

Looks like CI failed on windows not being to load symbols. You sure this PR was correct?

@amaanq
Copy link
Member Author

amaanq commented Mar 5, 2024

Yeah the line change in render.rs was a stupid mistake (and not really intentional, slipped my mind), oops. Sorry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tree-sitter.DLL is missing almost all exports
3 participants