Thread overview
suggestion add extern(GO)
Jun 06, 2023
d007
Jun 06, 2023
Johan
Jun 07, 2023
d007
June 06, 2023

golang support linker with asm without cgo at much fast speed.

From this blog you can see go can call rust function without CGO https://words.filippo.io/rustgo/

maybe add extern(GO) will bring D into a large user community.

extern(GO) should only support pointer and scalar arguments, and must be @nogc nothrow.

June 06, 2023

On Tuesday, 6 June 2023 at 15:46:00 UTC, d007 wrote:

>

golang support linker with asm without cgo at much fast speed.

From this blog you can see go can call rust function without CGO https://words.filippo.io/rustgo/

maybe add extern(GO) will bring D into a large user community.

extern(GO) should only support pointer and scalar arguments, and must be @nogc nothrow.

The way I understand the article, nothing new is needed on the D side: you use extern(C) (and -betterC if you don't want to link with druntime).

-Johan

June 07, 2023

On Tuesday, 6 June 2023 at 16:54:07 UTC, Johan wrote:

>

The way I understand the article, nothing new is needed on the D side: you use extern(C) (and -betterC if you don't want to link with druntime).

-Johan

you are right, any extern(C) from static or dynamic library should be able to link into golang.

What I like to do is like extern(C++) or extern(Objc), add extern(GO) support, generate function is able to call from go without extra trampoline. (generate syso file to link with go)