How to use a native C function as callback function in jswrap functions? #7582
Replies: 1 comment
-
Posted at 2017-03-23 by @gfwilliams You need to do something like this: https://github.com/espruino/Espruino/blob/master/src/jswrap_promise.c#L83 Note the JSWAT_* enums determine what arguments the function takes. Just use JSWAT_VOID in your case. Posted at 2017-03-23 by Aifer @gfwilliams Is there a document which explains the usage of jsvLock and jsvUlock? Or, some documets describe the mechanism of native code? Posted at 2017-03-23 by @gfwilliams Not really, no. You'd need to look at other code, or there are some good threads on this forum. Also worth looking at http://www.espruino.com/Internals However, I can't assist you - especially as you're not using one of the official Espruino boards. If you're doing this for a company and they need assistance then I can do consultancy work. Posted at 2017-03-23 by Aifer @gfwilliams I'm making a toy for my kid. I like javascript. Espruino makes it easy to write JS code for MCU. It's a wonderful platform. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2017-03-23 by Aifer
In a C native module, I want to call other jswrap functions and asign my C function as the callback.
How to do that?
For example,
void mycallback();
Beta Was this translation helpful? Give feedback.
All reactions