-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Add EMSCRIPTEN_EXPORT option #4977
base: main
Are you sure you want to change the base?
Conversation
can we eventually get rid of EMSCRIPTEN_KEEPALIVE? |
oh, this is |
Just my 2ct: I think the name EMSCRIPTEN_EXPORT is useful because it gives an association to the EXPORTED_FUNCTIONS linker-stage command line option, and it also is similar to DLL_EXPORT (from the Windows world). |
I think we never needed to differentiate exporting from keeping alive, doing both always made sense in practice. If we do want to split them up as @dschuff suggests, we probably shouldn't merge this as it would mean we need to change what this macro does later. |
I'm fine with not merging this yet if EMSCRIPTEN_EXPORT would need to change later anyway. I have my code annotated now with EMSCRIPTEN_KEEPALIVE and it's working fine. |
Are we still interested in landing this? |
I'm not sure. Are we adding clang intrinsics for wasm imports and exports? Those would probably be better than this if so. |
does |
Yes, currently It seems like whatever the final mechanism we decide to under the hood we still want an emscripten-specific macro like this for some added indirection and explicitness. |
The deletion of the Re-opening and re-targeting to master. |
I think we should still land this. Can you rebase? |
I think maybe we want to do this as part of a larger exporting refactoring, #8380 so best to wait on that (for which I'm not sure when I'll have time). |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
Are we still using |
Yes, it would be good to get around to this. But I think #8380 is the better idea, to do a larger refactoring of export names. Unless there is incremental benefit to this PR, I think we can close it. |
I think having a better name than EMSCRIPTEN_KEEPALIVE to use in the source code is interdependently a good change. #8380 seems to deal only with external/link-time settings, rather than source annotations. |
This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant. |
I still think we should do this |
Is I am using 2.0.19 in unity and |
Yes |
Thank you for your clarification. But then I could say it then not equivalence. Because with To be honest I try to use I hope there could be some annotation that can explicitly force function to being export and not being trim out of optimization process. And I wish |
Is the object file in question part of a |
I am not so sure and I guess it's not. There is no obvious And what I know is only that append |
Well this I think we can assume that unity is building .a archive under the hood since that is the only way that Sadly, for symbols that live inside of archive files, when the linker skips the entire object file all the information in it is completely skipped, including any symbol attributes. Making
Sadly both (2) and (3 ) require custom command line flags. (1) might be an option is you have at least one object file that you know will be included than you can include dummy references to symbols in question. For example:
Include that line in a file that you know will be included at link time will cause the linker to include the object file that contains myfunc. |
Thank you for your suggestion. Still I wish that there could be some non hacky way for this. IMHO I think the function I expected to be export should be defined at the function declaration itself, not the compiler flags, regardless of archive generation method I would try to see which way is suitable for developing in unity webgl. Thanks for all enlightened information |
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.
Should we land this ancient PR? I think it probably useful regardless of what we do with command line flags.
#include <emscripten.h> | ||
#include <math.h> | ||
|
||
extern "C" { |
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.
Make this into a .c
file avoid this extern "C"
block.
Yeah, I think this is worth having (and worth naming correctly) if we're confident we can support it going forward (and I think we can, even if LLVM manages to replace |
If we are certain we can replace |
I think the idea would be not that we are sure that we can replace Are you saying that in the future we might want to switch to a different mechanism other than attribute(used), which might end up being a breaking change, so we should avoid introducing new user-facing names until that time? |
Sorry, I thought I'd replied to this long-ago notification, but it seems I did not. Yes, that was what I was saying. |
From the mailing list discussion,
EMSCRIPTEN_KEEPALIVE
isn't the best name, so adding another alias makes sense. Also use this in the docs.