[riot-notifications] [RIOT-OS/RIOT] pkg: add support for Elk Tiny Javascript engine (#16887)

benpicco notifications at github.com
Fri Sep 24 15:15:18 CEST 2021


@benpicco commented on this pull request.



> + * @author      Alexandre Abadie <alexandre.abadie at inria.fr>
+ *
+ * @}
+ */
+#include <stdio.h>
+#include "elk.h"
+
+/* C function that adds two numbers. Will be called from JS */
+int sum(int a, int b) {
+  return a + b;
+}
+
+int main(void) {
+  char mem[256];
+  struct js *js = js_create(mem, sizeof(mem));  /* Create JS instance */
+  jsval_t v = js_import(js, sum, "iii");        /* Import C function "sum" */

"iii" is for "takes two integers, returns an integer?" 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16887#pullrequestreview-763065061
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210924/f7ea8e8a/attachment.htm>


More information about the notifications mailing list