Page 1 of 1

external C library

Posted: Sat Jun 09, 2018 7:19 pm
by VladVons
is it possible to write external C library, save compiled file as SomeFile.so and call it from a python?
Something like plugins or libraries
Other words move trash outside micropython core and reduce its size with more ussage flexibility
DHT
cc3000
lcd160cr
....

import SomeFile
SomeFile.SomeMethod()

Re: external C library

Posted: Sun Jun 10, 2018 1:08 pm
by stijn
I'm not sure what the current status is, from a search on github there have been at least 3 different implementations providing some kind of support for this:
- https://github.com/micropython/micropython/pull/1627
- https://github.com/micropython/micropython/issues/3311
- https://github.com/stinos/micropython/c ... 857d4c1b54

Re: external C library

Posted: Mon Jun 11, 2018 10:01 am
by VladVons
No working howto examples found.

Dynamically loadable native object code is definitely a feature that MicroPython wants to have, it would be very useful
(Damien George, Sep 11, 2017)

Re: external C library

Posted: Mon Jun 11, 2018 11:19 am
by stijn
VladVons wrote:
Mon Jun 11, 2018 10:01 am
No working howto examples found.
Did you try and build the modx sample included in 1627?
Or build https://github.com/stinos/micropython-w ... r/Makefile, which definitely works? (it builds a .so from tests/module.cpp then runs micropython on a bunch of test files which all load import from the .so)