jerryscript-project / iotjs

Platform for Internet of Things with JavaScript http://www.iotjs.net
Other
2.58k stars 440 forks source link

How can I add new modules ? #1938

Closed yyykkkyyy closed 4 years ago

yyykkkyyy commented 4 years ago

Hi, 'm really appreciate this wonderful library.

By the way, I'd like to add some original new modules. I made a directory which is named "my-module" and I also created a sub-directory "modules" into the "my-module" directory. I put some C files in the "my-module/modules" directory.

I'd like to include some JerryScript header files like #include jrt.h. But I cannot do that. When I do ./tools/build.py --external-modules=./my-module --profile=my-module/mymodule.profile, the error message "no such file or directory #include jrt.h" appears.

I think that JerryScript's files are available in IoT.js library because JerryScript files are in "deps/jerry" directory.

When I'd like to use other header files, how can I add include paths ?

And, can I call IoT.js functions in original new modules ?

I look forward to hearing you. Thanks.

LaszloLango commented 4 years ago

jrt.h is an internal header file, you should not directly include it in an IoT.js module. However you can specify a cmake file for your custom module where you can add include directories as well.

yyykkkyyy commented 4 years ago

Thanks for your answer !