external C library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
VladVons
Posts: 60
Joined: Sun Feb 12, 2017 6:49 pm
Location: Ukraine

external C library

Post by VladVons » Sat Jun 09, 2018 7:19 pm

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()

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: external C library

Post by stijn » Sun Jun 10, 2018 1:08 pm

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

VladVons
Posts: 60
Joined: Sun Feb 12, 2017 6:49 pm
Location: Ukraine

Re: external C library

Post by VladVons » Mon Jun 11, 2018 10:01 am

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)

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: external C library

Post by stijn » Mon Jun 11, 2018 11:19 am

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)

Post Reply