germassage.blogg.se

Swig software wrapper
Swig software wrapper






This article covers how to write a C program that launches a Lua interpreter and then how to use SWIG to generate the necessary wrapper code to allow Lua scripts to access the functions and data inside of the C runtime.Įxtern int32_t multiply ( int32_t x, int32_t y ) #ifdef _cplusplus

swig software wrapper

Thankfully, there is a project which helps automate the generation of this boilerplate code called SWIG. The result is writing a lot of wrapper code integrating the two languages together that then must be maintained as the application evolves. There are ways to make Lua and C work together and share data structures, but it requires a lot of boilerplate and complex code. Many of the libraries today for embedded devices are written in C, not Lua! You can think of Lua as an alternative to the MicroPython (Python) or JerryScript (Javascript) interpreters. For these reasons, many great teams are choosing to include a Lua interpreter in their embedded project (e.g. It’s fast, uses little memory, is written in ANSI C, and is known by plenty of developers.

swig software wrapper swig software wrapper

Lua is one of the many great interpreters that can be run on embedded devices.








Swig software wrapper