BoneScript
You might be able to see a newer version of this on beagleboard.org/support/bonescript/writeCModule
loadCModule(filepath,fnNames&arguments, isMRAA)
Loads functions from the C program provided at the path with Function names and arguments in the fnName&arguments input.
Arguments
- filename: complete path of the C file
- fnNames&arguments : (object)contains functions name and input/output arguments in the format:
{function_name : [ 'outArgType' , [ 'inArg1Type',inArg2Type',...]]}
function_name: (string) corresponds to the name of the function to be loaded.
outArgType: (string) corresponds to the output argument type of the function loaded.
inArgTypeZ: (string) corresponds to the input arguments type of the function loaded.
- isMRAA: (boolean)whether to link link mraa headers during compilation(default : false).
return
- x: (object)the function loaded corresponding to the input provided
Example
var b = require('bonescript');
var args = {
'main': ['int', ['int']]
};
var x = b.loadCModule('/usr/share/bone101/examples/extras/helloworld', args,false);
x.main(1, function (err, res) {}); //default sync usage
//x.main.async(1, function (err, res) {}); //async usage
Build and execute instructions
- Run the above to load a helloworld.c program at the path generated using writeCModule
- Modify the Path and Args to load other modules.
