Hello i need to write 4 libraries in 3 different languages for 2 platforms for my PCB module to work on the raspberry pi and arduino. Most of the library just contain functions of bit manipulation which will then be passed to a function that will be unique to each language and platform combination.
So basically the 4 libraries will be 90-95% identical. Now i find it very inefficient that i will have to code for all 4 libraries, where all i do is just adjust the syntaxes. This can also be a pain when there is an update that has to be done on the library because you have to update all 4 of them. There has to be a better way of doing this
My idea is to have a core library where it will be written in one language that can be loaded by a some sort of Hardware Abstraction Layer (HAL) written using the three different languages it is needed python, javascript, and c++. My problem is what will that language be. And what will i use to load it into the other languages. Would C be my best option?
ctypes
to load a C library and javascript can usewasm
. There might be other alternatives out there but this is what I found. – Ruks May 30 '20 at 8:16extern "C"
. You might be able to do it similarly for javascript. There's no need for a HAL for C++ if you do it like that. – Ted Lyngmo May 30 '20 at 8:27