53 karma · joined Feb 12, 2023 (3y ago) · 7 submissions
comment 3y ago · link · parent
[0] - https://go.dev/doc/asm
comment 3y ago · link · parent
I do want to write an article about how purego works under the hood.
comment 3y ago · link · parent
comment 3y ago · link · parent
comment 3y ago · link · parent
Just call purego.Dlopen(“libname.so”, purego.RTLD_GLOBAL)
Take the returned library (make sure to check for errors with purego.Dlerror() first) and call purego.Dlsym(lib, “cfuncName”). If it exists than u can call it with either purego.SyscallN or purego.RegisterFunc
comment 3y ago · link · parent
I’ve actually been quite interested in Zig. If that built-in was added than it would likely be possible to grow the goroutine stack to the proper size and than call the Zig code. Very interesting stuff!