-
-
Notifications
You must be signed in to change notification settings - Fork 812
ICU-23136 Remove __declspec(dllexport) from class Locale on Windows #3521
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
base: main
Are you sure you want to change the base?
Conversation
There's a |
This comment was marked as outdated.
This comment was marked as outdated.
Digging in the export tables, and a bunch of entries seems to be dropped (not exported anymore). I was unable to figure out a clear rule. Most worrisome (I think) is the disappearance of some public entries, mostly constructors. The intriguing part is that not all constructors disappear, only some. |
I think that since
So
https://learn.microsoft.com/en-us/cpp/cpp/cdecl?view=msvc-170 I think that calling it |
C++ likes to auto-generate member functions. We have tried to define them explicitly, so that we can tag them with their status, but I think that's becoming less tenable with it generating more and more things like symmetric operator== and opterator!=. If the auto-generated ones are no longer reliably exported, then that seems like a problem. No longer reliably exporting explicitly declared methods is of course even worse :-(
I reminded myself that U_COMMON_API is the same as U_EXPORT or U_IMPORT or nothing depending on whether we compile ICU itself or user code. So I think these static member functions should use U_COMMON_API instead of U_EXPORT. And if it is harmless (= does not break CI) to also keep the U_EXPORT2 where it's always been, then so much the better. IOW please try to treat the static member functions the same as the non-static ones. @mihnita since you have a Windows machine, can you please try this?
|
There is no difference in the export table between this and what Fredrik does. |
I tried, there is no difference in the export table between this and the result with the current PR change. And I am pretty sure I've commented this a few days ago, but somehow GitHub "forgot" it. |
Ok. So Windows/Mac/Linux don't care either way. The current attribute combinations are a result of long-ago trial-and-error with a larger set of platforms. Is there any reason not to make the more conservative change? If not, then I am willing to add a commit to that effect. |
I would just like to avoid making any change at all before we find someone who can say what the preferred way of doing this really is. At the moment we have two potential options but we don't know whether any of them is the preferred way, there might be a third option that we're not yet aware of, so making any such change now would be wasted effort if it later needs to be changed again. That's all. |
Well, we don't seem to have an actual expert. Note also that the macros like U_COMMON_API resolve to either import or export depending on which code you are compiling. U_COMMON_API wants to export from the common library, and import into the i18n library, into ICU tools & tests, and into non-ICU code. Changing U_COMMON_API to just U_EXPORT seems misleading at best. I will give it a try, see what CI says, and ask Mihai to try it on his Windows machine as well. |
There is a pretty long list of differences between what is exported "the old way" and "the new way" There are differences even for members declared public, which I would expect to be preserved. Let's say we don't worry too much about extra exports (although I kind of think was the point of this exercise?) But missing public exports seems worrisome. See here an archive with the old / new exports: https://mihai-nita.net/tmp/diff_exports.zip There is no risk that I built at different commit points. |
Apart from the ones that I believe to have been exported by mistake before, have you seen any other public declarations missing now? I can't find any such in your dump files (but I haven't checked every single entry that differs).
Are any of those such members that the changes in this PR ought to remove? The changes in this PR only touch a tiny fraction of the code base, most private or protected members should be unaffected by these changes. |
Mihai and I are looking at the diffs. Some of the symbols that are no longer supported are private functions, and as long as they are not called from inline code in the header file, that's fine. I worry a bit about no longer exporting some of the vtables, for example
and a bunch of others. On the other hand, if CI checks are happy... 🤷 ? |
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.
Added another commit after Mihai and I reviewed the changes in symbol exports.
If this passes CI and no one has ideas for what else to test and what more to change, then I suggest we remove the first commit (the temporary test one), squash the rest, approve, and merge.
I broke CI. I should have known better: The three internal classes that I exported again have Locale fields, which must be why Fredrik un-exported them. I changed these to U_I18N_API_CLASS class now. |
It looks like the MSVC builds, and thus CI checks overall, are happy now. So we are back to my suggestion:
|
This makes private std::unique_ptr & std::variant members possible.
Notice: the branch changed across the force-push!
~ Your Friendly Jira-GitHub PR Checker Bot |
Elsewhere, @mihnita gave me a "thumb up" for this. I have now removed the test commit 540a96a so this should be ready for review & approval. Once approved, let's squash, and then merge. |
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.
Thank you very much for the patience
Checklist