New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ support in User Modules #6233
Comments
So far these edits seem to work (testing only a very simple cpp file with one class definition) Notably you now also have SRC_USERMOD_CPP += lines in your micropython.mk Testing now with trying to get Tensorflow to build.. |
I got tensorflow CPP library working here in a really hacky way
This obviously isn't a scalable way to build modules with CPP in the future, but helps outlines perhaps the missing steps within the current Makefile system. |
For the record, it's already possible and works very well. You can look at this repo for a few examples. And you probably can write an extension in any compilable language actually, you just need a tiny bit of C code for interop. I think this issue should be closed 😄 |
@Ecco - Great to hear it should already be working A few notes as to why this issue might not be closed just yet.
It's possible that compatibility with cpp files varies between hardware platforms. I'm not sure which hardware the Epsilon (which looks really cool btw) has been tested on. The more I looked into fixing this issue myself, I feel like it's a really easy fix for somebody who knows the Micropython Makefile system (I ended up making a simple bash script to build the cpp files manually) |
Note: the ESP32 Makefile already has a rule for building C++ files. I'd suggest to start with moving that to mkrules.mk already: it doesn't hurt, I think, plus it makes the amount of changes required to add C++ files to the build smaller in general. I.e. add
to mkrules.mk since it already has the same for C files. |
@dpgeorge this can be closed now |
nrf: Correctly mark PWM unused during reset
Hey
I understand that Micropython itself is written in C and not C++
However, a user might want to develop a micropython module which calls to a C++ library or is written in C++ code.
Currently, this is very difficult, as the Makefile system currently does not support C++, and is itself very a complicated Makefile system (especially for an outsider).
I presume that it's not necessary to change the micropython C code at all, but just to change the Makefiles.
The repository https://github.com/stinos/micropython-wrap is interesting. But this currently does not support microcontrollers, so I've added an issue at stinos/micropython-wrap#5 there also
Thank you
Elliot
The text was updated successfully, but these errors were encountered: