You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CGo is Go's mechanism for calling C code. The current LLGo compiler primarily uses go:linkname and llgo:link to call C libraries, with additional requirements like LLGoPackage and LLGoFiles. Compared to CGo, this approach lacks static checking and uses a different mechanism, potentially causing a split between Go and LLGo libraries.
CGo is mature but has additional overhead due to Goroutine compatibility.
We aim to implement CGo functionality for compatibility with the standard Go compiler. This proposal explores two potential implementation approaches.
Background
CGo is Go's mechanism for calling C code. The current LLGo compiler primarily uses
go:linkname
andllgo:link
to call C libraries, with additional requirements likeLLGoPackage
andLLGoFiles
. Compared to CGo, this approach lacks static checking and uses a different mechanism, potentially causing a split between Go and LLGo libraries.CGo is mature but has additional overhead due to Goroutine compatibility.
We aim to implement CGo functionality for compatibility with the standard Go compiler. This proposal explores two potential implementation approaches.
Approach 1: Reuse cgo tool, implement runtime.cgocall
Overview
Reuse existing cgo tool, reimplement
runtime.cgocall
function, and implement packed args functionality.Pros
Cons
Implementation Steps
runtime.cgocall
function for LLGo.Approach 2: Reuse Go compilation process, implement LLGo as a GO's
compile
toolExperimental implementation: #841
Overview
Deeper modifications, reusing Go's compilation process, rewriting cgo tool, and implementing a new compile stage.
Go Compilation Process
Implementation Steps
Pros
Cons
The text was updated successfully, but these errors were encountered: