Skip to content
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

Use Cgo to support C modules #235

Open
AverseABFun opened this issue Oct 11, 2024 · 6 comments
Open

Use Cgo to support C modules #235

AverseABFun opened this issue Oct 11, 2024 · 6 comments

Comments

@AverseABFun
Copy link

I'll be honest; I'm completely new to this project and know next to nothing about it, so if there's a known reason Cgo wouldn't work, sorry. However, I think that using Cgo could be an easy(ish) way to support other modules, however likely with some changes for how Gpython works over others.

@ncw
Copy link
Collaborator

ncw commented Oct 12, 2024

We could certainly initialise and run python modules written in C, however we'd have to re-implement all the C services that they rely on so that the Go equivalent got called. Given that the implementation of Python objects is completely different to that of CPython I'd put this in the very hard but not quite impossible category!

@sbinet
Copy link
Member

sbinet commented Oct 12, 2024

another option (possibly as difficult or work intensive) would be to emulate the C API as PyPy did with its cpyext module:

@corona10
Copy link
Collaborator

My personal suggestion is targeting HPy instead of C API itself, C API expose too much of implementation detail from CPython.
https://hpyproject.org/

@corona10
Copy link
Collaborator

FYI, GraalPython and PyPy success to support HPy

@corona10
Copy link
Collaborator

(By the way, long time no see people)

@sbinet
Copy link
Member

sbinet commented Oct 12, 2024

yes, I was about to suggest HPy as well (but was refreshing my memory a bit about it before posting :})

anyways: whatever the avenue gpython chooses, it's a very long and hard road, which (to be honest) is probably not sustainable with the current workforce available for this project (sadly, but it is what it is)

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