-
-
Notifications
You must be signed in to change notification settings - Fork 763
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
ICU-22876 add U_SHOW_CPLUSPLUS_HEADER_API for C++ header-only APIs #3161
ICU-22876 add U_SHOW_CPLUSPLUS_HEADER_API for C++ header-only APIs #3161
Conversation
ac0180c
to
f3e27d5
Compare
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great.
By the way, I checked, and even though we prohibit use of C++ APIs, we (Apple) still (for some reason) explicitly define U_SHOW_CPLUSPLUS_API
to be 1
in our own makefiles. I'm going to guess it's so that we could still run the C++ unit tests, since the C unit tests don't replicate all the checks that are in the C++ ones, but that's just a guess. There might be other reasons, and there might be things we could do to allow testing through the C++ interfaces without exposing them to the world (or maybe I'm wrong and this works fine as it is). @pedberg-icu might be able to fill in some background here.
@richgillam I suggest you turn on U_SHOW_CPLUSPLUS_API only for integration testing ICU, and turn it off for anyone using ICU. |
@richgillam As I recall, in the Apple makefiles, U_SHOW_CPLUSPLUS_API is set to 1 for when Apple builds ICU and runs unit tests. But when Apple clients are building against ICU headers, they are not getting the makefile override, and they normally get the default setting of U_SHOW_CPLUSPLUS_API in utypes.h, which Apple changes to be 0. And furthermore, if a client externally overrides U_SHOW_CPLUSPLUS_API to be 1, they will get all sorts of compile warnings about that resulting in code that is not binary-compatible across updates and cannot be used in production. |
@pedberg-icu Ah! That totally makes sense. I do see our local change to do that now. Thanks for the explanation! |
This lets users who define U_SHOW_CPLUSPLUS_API=0 to not rely on unstable C++ DLL exports use C++ header-only APIs on top of stable C exports.
As discussed in the 2024-sep-12 ICU-TC meeting.
(FYI All of these visibility controls are marked
@internal
.)Checklist