Skip to content

Conversation

@owent
Copy link
Member

@owent owent commented Oct 25, 2025

Fixes #3665
Fixes #3620

Changes

  • Set dllexport_decl for proto targets and can be built as shared on windows.

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

Copilot AI review requested due to automatic review settings October 25, 2025 02:45
@owent owent requested a review from a team as a code owner October 25, 2025 02:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables building Protocol Buffer (protobuf) targets as shared libraries on Windows by implementing proper DLL export/import declarations. Previously, protobuf targets were forced to be static libraries on Windows, but this change adds the necessary infrastructure to support shared library builds across platforms.

Key changes:

  • Added CMake helper functions for managing export/import declarations across different compilers and platforms
  • Modified protobuf generation to include dllexport_decl parameter for proper Windows DLL support
  • Removed Windows-specific restriction forcing static library builds for protobuf targets

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
cmake/tools.cmake Adds utility functions for generating platform and compiler-specific DLL export/import declarations
cmake/opentelemetry-proto.cmake Integrates DLL declarations into protobuf targets, removes Windows static-only restriction, and adds formatting improvements

@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.01%. Comparing base (d37c579) to head (0ad054e).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3714   +/-   ##
=======================================
  Coverage   90.01%   90.01%           
=======================================
  Files         225      225           
  Lines        7105     7105           
=======================================
  Hits         6395     6395           
  Misses        710      710           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@owent
Copy link
Member Author

owent commented Oct 29, 2025

My MSVC have LNK2001 unresolved external symbol for __std_find_last_trivial_1 , __std_search_1 , __std_search_1 , __std_min_8i and many other STL's symbols, I will wait the next VS update and continue this work then.

@owent owent force-pushed the support_build_proto_as_dll branch from c45538c to 39314ef Compare November 1, 2025 02:50
@owent owent changed the title [DRAFT] Support build proto as shared lib on Windows Support build proto as shared lib on Windows Nov 1, 2025
owent added 6 commits November 9, 2025 21:13
Adds warnings to inform users when the build type for `opentelemetry-proto` is automatically adjusted to maintain consistency with protobuf, potentially overriding the global `BUILD_SHARED_LIBS` setting.
@owent owent force-pushed the support_build_proto_as_dll branch from 01b3a7c to 1a4630c Compare November 9, 2025 13:41
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.

Opentelemetry windows runtime issue v1.22.0 no longer respects BUILD_SHARED_LIBS: ON

1 participant