On Sat, 13 Mar 2021 22:57:11 -0800 (PST)
"Jason E. Aten" <j.e.a...@gmail.com> wrote:

> Iminimize the cost of crossing the CGO barrier from Go code into C code and 
> back.

I personally regard this cost as godsend ;) It incentivises us to rewrite C 
codebases into proper Go.

> Instead of teaching the Go compiler how to better run C code, what if a C 
> compiler (e.g. clang) was taught to generate code that used the Go stack 
> and calling conventions.

Someone would need to do it, then maintain it.

> Theoretically, the cc output "in Go convention" could be linked with Go 
> code without paying the CGO penalty, no?

Not that easy. Elias Naur already said why.

> How crazy is this? :)

There are more "crazy" solutions that actually work:

Eg. if you really need to hook at battle-tested C code that needs no further 
maintenance, you may try  https://github.com/minio/c2goasm 
It lets you bootstrap fast, then you may aim at a proper rewrite.
 
Caveats: https://github.com/golang/go/issues/40724 
https://github.com/golang/proposal/blob/master/design/27539-internal-abi.md

Hope this helps,

-- 
Wojciech S. Czarnecki
 << ^oo^ >> OHIR-RIPE

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/20210314123016.12f59da6%40macmint.

Reply via email to