-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Interfacing with external C #2846
Comments
This is typically accomplished by specifying imports and exports. For example, an external host function can be @external("myModule", "add")
declare function add(a: i32, b: i32): i32;
add(1,2); Or a function can be made callable by the host by export function add(a: i32, b: i32): i32 {
return a +b;
} See also: Concepts / Module imports and exports |
Thanks @dcodeIO for the reply. I read the documentation you attached, however I believe assemblyscript is only enabled for js host. I can be completely wrong here. When I am using external decorator for wrapping console.log as consoleLog, and when I am calling it in my wasm module, WAMR gives me linking error. So I think it also expects the runtime to dynamically link certain functions for example console.log. Is there also any restriction of what runtime we are using ? |
So @dcodeIO below I am also attaching the code I have in
This successfully compiles to .wasm file. Then when I am trying
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in one week if no further activity occurs. Thank you for your contributions! |
Question
I want to know if it is possible that external C can be called inside assemblyscript. Any way to define C function prototype which will be provided by the host code through a WASM runtime like WAMR. Also, it is possible in assemblyscript that some functions can be exported in compiled wasm module.
The text was updated successfully, but these errors were encountered: