Skip to content
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

When exporting functions from a C++ module, it is necessary to specify EXPORTED_FUNCTIONS for each function. #22608

Closed
xengine-qyt opened this issue Sep 23, 2024 · 3 comments

Comments

@xengine-qyt
Copy link

xengine-qyt commented Sep 23, 2024

Is there any other way to automatically export all functions from a file?
Or specify a macro in front of the functions to be exported?

@sbc100
Copy link
Collaborator

sbc100 commented Sep 23, 2024

No, there is no mechanism for that I'm afraid. I'm not sure I'd want to add one either. What would your use case be fore exports so many functions? Normally folks either exports small fixed set of functions, or use something like embind to export a more rich set. What is your use case?

@sbc100 sbc100 transferred this issue from emscripten-core/emsdk Sep 23, 2024
@xengine-qyt
Copy link
Author

No, there is no mechanism for that I'm afraid. I'm not sure I'd want to add one either. What would your use case be fore exports so many functions? Normally folks either exports small fixed set of functions, or use something like embind to export a more rich set. What is your use case?

I have a cross-platform framework module library, and the export functions are already in place. There are many functions to export, so I thought this approach might be more convenient. Specifying them one by one is very time-consuming... So I wanted to ask if there is a more convenient mechanism.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 25, 2024

The reason I think we don't have that mechism is that in general raw C/C++ are not very useful when exposed to JavaScript. Do you intend to try to call these function directly from JS? Normally you would want to do something like embind to make your library accessible to JS. Calling wasm functions directly from JS or using ccall (for example) is a fairly rare case I believe.

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

No branches or pull requests

2 participants