C/C++ code can import functions from BrightScript can call them directly as long as they only take primitives such as Byte, Integer, LongInteger, Float, Double. This is because these types have a direct translation to WebAssembly. See for example:
https://github.com/MotleyCoderDev/wasm2brs/blob/30bce4e437dce1a6bec1511ba465ae7b53d24f83/include/roku.h#L18
The ROKU_BUILTIN(...) will import a function defined in BrightScript under that exact name, such as Sleep.
That said, just like in WebAssembly there is no way without a binding/glue layer to import functions that take and return BrightScript objects. That means you'll need to write glue code in BrightScript that you then call from C/C++/Rust, and the glue code can only use primitive data types.
I personally see this library as being more useful for compiling and binding libraries to BrightScript, rather than writing an entire gui in C/C++. If you have other questions feel free to ask :)
Hi Vini,
C/C++ code can import functions from BrightScript can call them directly as long as they only take primitives such as Byte, Integer, LongInteger, Float, Double. This is because these types have a direct translation to WebAssembly. See for example: https://github.com/MotleyCoderDev/wasm2brs/blob/30bce4e437dce1a6bec1511ba465ae7b53d24f83/include/roku.h#L18 The
ROKU_BUILTIN(...)
will import a function defined in BrightScript under that exact name, such as Sleep.That said, just like in WebAssembly there is no way without a binding/glue layer to import functions that take and return BrightScript objects. That means you'll need to write glue code in BrightScript that you then call from C/C++/Rust, and the glue code can only use primitive data types.
I personally see this library as being more useful for compiling and binding libraries to BrightScript, rather than writing an entire gui in C/C++. If you have other questions feel free to ask :)