8000 How to load dll in up? Does upy has something like ctypes.CDLL of CPython? · Issue #5262 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

How to load dll in up? Does upy has something like ctypes.CDLL of CPython? #5262

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

Closed
fei2020 opened this issue Oct 27, 2019 · 4 comments
Closed

Comments

@fei2020
Copy link
fei2020 commented Oct 27, 2019

I have quickly glanced at uctypes module. DLL is not meantioned in it.
Thanks.

@MrSurly
Copy link
Contributor
MrSurly commented Oct 27, 2019

Typically, loadable shared libraries (and non-interpreted executables) are not really a thing in the sort of embedded environment that μP is targeting. The exception being the Unix port, but you might as well just use regular Python in that case.

@peterhinch
Copy link
Contributor

DLL's are generally compiled for X86. Could any SoC run them? In terms of MicroPython targets, Unix would be the only option.

@jimmo
Copy link
Member
jimmo commented Oct 27, 2019

MicroPython supports this on the Unix port via the FFI module (import ffilib). It's somewhat similar to uctypes.LoadLibrary (and relies on uctypes for return values). See #3078 for discussions around the Windows port. And see https://github.com/micropython/micropython-lib/blob/master/re-pcre/re.py for an example that uses it to load libpcre.

But I would imagine you're probably asking about doing this on a microcontroller platform? As already explained above, this wouldn't be possible with an existing .dll file compiled for x86, but if you're able to build it from scratch, then you might be able to generate a .mpy instead.

Since v1.11 the .mpy format has supported native code, making a .mpy file conceptually similar to a .dll (or equivalently a .so on other platforms). See #5083 for recent work by @dpgeorge to make it possible to compile an existing C library into a .mpy file.

@jimmo jimmo closed this as completed Oct 27, 2019
@fei2020
Copy link
Author
fei2020 commented Oct 31, 2019

Thank you. I will try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
0