Re: [go-nuts] Re: Passing 2d arrays from Go to C using runtime.Pinner

2024-01-31 Thread peterGo
Michael, Here is a Go solution to the OP's problem. It uses Go memory and Go pointers passed to C in Go memory point to pinned Go memory. https://go.dev/play/p/KLdenIesz1K Peter On Monday, January 29, 2024 at 12:21:18 PM UTC-5 Michael Knyszek wrote: > Thanks for the reproducer. I think I've p

Re: [go-nuts] Re: Passing 2d arrays from Go to C using runtime.Pinner

2024-01-29 Thread 'Michael Knyszek' via golang-nuts
Thanks for the reproducer. I think I've puzzled out what's going wrong and it's pretty subtle. TL;DR: You can work around this by either calling `calloc` or just allocating `inRows` as Go memory and pinning that as well. The latter will be safer and faster overall. It's not totally clear to me at