Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This post led me to purego, and I've just finished moving my toy project that uses PKCS#11 libraries from cgo to it. It's so much better now! No need to jump through hoops for cross-compilation.


IME Linux and macOS users usually have a compiler available so CGO is mostly only a hassle for Windows, but on Windows this capability is built into the Go stdlib, e.g. `syscall.NewLazyDLL("msvcrt.dll").MustFindProc(...)`


Thank you for pointing out this option. Any idea why the Go stdlib doesn't offer this for Linux and macOS? I'd rather not add compiling other languages to my Go workflow.


How is the latency of calling purego bindings vs cgo? The latter seems prohibitively expensive for most of my projects.


IIRC, purego repurposes a lot of cgo machinery, so I don't think there would be much difference. For my purposes, it doesn't matter since the ML library does several seconds to minutes of work using multiple cores per call.


I haven't checked (I make maybe 10 calls per second at most). Intuitively, they should be similar.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: