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
ENH Add Ctypes support #1656
ENH Add Ctypes support #1656
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very excited about the progress you have been making on this @hoodmane !
It built!! Finally! |
Uh-oh now it's failing with |
Indeed for some reason it didn't build a bunch of built in modules. |
Okay the build in 27df231 actually worked and a simple ctypes use works: >>> import ctypes
>>> tuple_size = ctypes.CFUNCTYPE(ctypes.c_long, ctypes.py_object).in_dll(ctypes.pythonapi, "PyTuple_Size")
>>> tuple_size((1,2,3))
3 https://6515-322074228-gh.circle-artifacts.com/0/root/repo/build/console.html |
The |
Okay so |
Right so |
I think the problem with |
Okay it broke between 66400d0 and 426f5b2. I guess that emsdk patch causes trouble -- those optimization passes I dummied out are probably necessary for the CLAPACK build to succeed. Luckily I can remove the patch because I found out it is caused by the |
Well removing that patch definitely fixes the CLAPACK build. But removing the bigint |
Looks like you found the solution, so I'm not going to be of much help :) |
Scipy imports are failing. I guess I'll restore the patch. |
Okay on 281c721 all tests passed except for two typical |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @hoodmane !
@@ -56,6 +56,9 @@ substitutions: | |||
- The standard library module `audioop` is now included, making the `wave`, | |||
`sndhdr`, `aifc`, and `sunau` modules usable. {pr}`1623` | |||
|
|||
- Added support for `ctypes`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Added support for `ctypes`. | |
- Added support for the [`ctypes`](https://docs.python.org/3/library/ctypes.html) | |
stdlib module. |
Resolves #728.
I took the libffi port started by @Brion and added support for structs and closures (and fixed some issues with
long double
). I have that code here:https://github.com/hoodmane/libffi-emscripten
It currently passes 56/56 of the "call" tests and 84/94 of the "closures" tests. It would be good to set up continuous integration for the library and to upstream it into the emscripten patches.