Re: [go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
On Sunday, May 10, 2020 at 12:33:08 AM UTC+2, Ian Lance Taylor wrote: > > On Sat, May 9, 2020 at 12:56 PM Gert > > wrote: > > > > This is the closest I get, I am out of ideas. Don't know why it runs but > doesn't update the string. > > I don't know what you are really trying to do, but I wan

Re: [go-nuts] Re: Trampoline example

2020-05-09 Thread Ian Lance Taylor
On Sat, May 9, 2020 at 12:56 PM Gert wrote: > > This is the closest I get, I am out of ideas. Don't know why it runs but > doesn't update the string. I don't know what you are really trying to do, but I want to be clear that this code is not supported. The supported way to call from Go to C is

[go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
This is the closest I get, I am out of ideas. Don't know why it runs but doesn't update the string. go run . test [116 101 115 116 0 0 0 0 0 0] 4 0 0 #include #include int hello(char *s) { char c[80]; strcpy (c, s); sprintf(s, "hello %s", c); printf("--\n"); return 0; } #include "te

[go-nuts] Re: Trampoline example

2020-05-09 Thread Gert
I am getting it to compile and run with this but I am struggling how you send a string pointer across a syscall that c can send back. Also not sure about the //go:nosplit I sprinkel around which one is actually right? package main import ( "syscall" "unsafe" "golang.org/x/sys/unix" ) //go: