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 the exported symbol name for 32-bit win32 DLL build #2190

Merged
merged 2 commits into from
Jun 10, 2023

Conversation

ThomsonTan
Copy link
Contributor

Fixes #2167

Changes

Some functions are mangled differently between win32 and win64 which is fixed in the export def file.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@ThomsonTan ThomsonTan requested a review from a team June 9, 2023 17:38
?Create@SimpleSpanProcessorFactory@trace@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanProcessor@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanProcessor@trace@sdk@v1@opentelemetry@@@std@@@std@@$$QEAV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@7@@Z
#else
?Create@SimpleSpanProcessorFactory@trace@sdk@v1@opentelemetry@@SA?AV?$unique_ptr@VSpanProcessor@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanProcessor@trace@sdk@v1@opentelemetry@@@std@@@std@@$$QAV?$unique_ptr@VSpanExporter@trace@sdk@v1@opentelemetry@@U?$default_delete@VSpanExporter@trace@sdk@v1@opentelemetry@@@std@@@7@@Z
#endif
Copy link
Member

Choose a reason for hiding this comment

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

Is there anything special about this symbol, that the name mangling is different for 32 and 64 bit. Could there be more such scenarios ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some flag is different in the name mangling between win32 and win64. There could be more for OTLP part, which I am building and check the expected symbols there. Thanks for the catch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got some reference on the name mangling of MSVC. Check p.30 in below doc. Seems the difference lies in the encoding of pointer type, and on 64-bit platform, the needs to be encoded as E which represents 64-bit, while on 32-bit this is not needed.
https://www.agner.org/optimize/calling_conventions.pdf

@codecov
Copy link

codecov bot commented Jun 9, 2023

Codecov Report

Merging #2190 (f52d82b) into main (c89a6fd) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2190   +/-   ##
=======================================
  Coverage   87.52%   87.52%           
=======================================
  Files         169      169           
  Lines        4887     4887           
=======================================
  Hits         4277     4277           
  Misses        610      610           

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM.

In a different PR, I think we need a link test that calls every exported API.
This test does not need to execute, just to link, to make sure apis are exported properly.

@ThomsonTan
Copy link
Contributor Author

LGTM.

In a different PR, I think we need a link test that calls every exported API. This test does not need to execute, just to link, to make sure apis are exported properly.

We have win32 x64 build in CI but no win32 x86 build there, probably we should add it.

@ThomsonTan ThomsonTan merged commit bd83aa3 into open-telemetry:main Jun 10, 2023
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.

Building as Win32 DLL failure
3 participants