Skip to content

Conversation

@CJCombrink
Copy link
Contributor

@CJCombrink CJCombrink commented Nov 3, 2025

Replace the global GlobalOutput variable with a static method call to get a singleton instance, preventing the need to export the symbol.

This issue also blocks conan from adding 0.22.0 (see conan-io/conan-center-index#27382)

  • Did you create an Apache Jira ticket? THRIFT-5898
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
    • This is a breaking change for users of the C++ library that uses the GlobalOutput variable
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

@uilianries
Copy link

@CJCombrink I just wanted to thank you for taking care of that issue!

@CJCombrink
Copy link
Contributor Author

I see the AppVeyor build now fails for something else:

TNonblockingSSLServerTest.obj : error LNK2019: unresolved external symbol "private: static bool apache::thrift::transport::TSSLSocketFactory::manualOpenSSLInitialization_" (?manualOpenSSLInitialization_@TSSLSocketFactory@transport@thrift@apache@@0_NA) referenced in function "public: __cdecl GlobalFixtureSSL::GlobalFixtureSSL(void)" (??0GlobalFixtureSSL@@QEAA@XZ) 

I will need to look into this as well

@CJCombrink
Copy link
Contributor Author

Applied the comment from here: #1714 (comment)
to the TSSLSocketFactory to remove the need for the exported member

Copy link
Member

@emmenlau emmenlau left a comment

Choose a reason for hiding this comment

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

Overall a good change.

PLATFORM: x64
CONFIGURATION: Release
BUILD_SHARED_LIBS: OFF
BUILD_SHARED_LIBS: ON
Copy link
Member

Choose a reason for hiding this comment

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

Could this be in a separate PR, to add shared library build? This PR here is 99% only about replacing GlobalOutput, which is useful to me independent of shared libraries.

Copy link
Contributor Author

@CJCombrink CJCombrink Nov 17, 2025

Choose a reason for hiding this comment

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

It is actually related: In #3229 I disabled building the shared libraries due to this PR still outstanding with the mention there that I would put it back, see b1e7cfb

Also building a shared library was broken and this is (my) the proposed solution to said problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To follow up on mail conversation:
The CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does not export global symbols according to the cmake docs

However, there are some cases when compiling code in a consumer may require explicit dllimport markup:

  • Global data symbols must be explicitly marked with __declspec(dllimport) in order to link to data in the .dll.

@CJCombrink CJCombrink force-pushed the THRIFT-5898_singleton_output branch from 02f8707 to 1471a68 Compare November 18, 2025 04:56
@CJCombrink CJCombrink force-pushed the THRIFT-5898_singleton_output branch from 1471a68 to 585f471 Compare November 20, 2025 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants