-
Notifications
You must be signed in to change notification settings - Fork 719
Add imported functions callback samples #4606
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
bd8d4ae
to
a3578eb
Compare
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.
I still think we should add some description in the comments of wasm_runtime_get_import_xxx()
in wasm_export.h, perhaps introducing this sample.
Need to execute samples in CI.
cd build | ||
cmake .. | ||
make | ||
``` |
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.
Need a section on how to run. Additionally, I believe we can simplify the execution by removing those options.
target_link_libraries (import-func-callback vmlib -lm -ldl -lpthread ${LLVM_AVAILABLE_LIBS}) | ||
else () | ||
target_link_libraries (import-func-callback vmlib -lm -ldl -lpthread -lrt ${LLVM_AVAILABLE_LIBS}) | ||
endif () |
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.
Missing CMake to generate Wasm.
ab0d448
to
500e809
Compare
the ci failure doesn't seem like a fault of this PR. |
core/iwasm/include/wasm_export.h
Outdated
@@ -1526,6 +1526,8 @@ wasm_runtime_get_native_addr_range(wasm_module_inst_t module_inst, | |||
/** | |||
* Get the number of import items for a WASM module | |||
* | |||
* Example usage (as shown in samples/import-func-callback) |
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.
maybe,
* Example usage (as shown in samples/import-func-callback) | |
* Example usage (as wasm_runtime_for_each_import_func() in samples/import-func-callback) |
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.
maybe,
resolved. thanks
Signed-off-by: zhenweijin <[email protected]>
500e809
to
236ea1f
Compare
In scenarios that require permission control, users may want to know if a Wasm app has the authority to use the native APIs it's about to import. To address this, we've added a callback that executes when the Wasm module loads an imported function.