3 ms·
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 th
by cyberax 2y ago
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.
- mappu 2y agoIME 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(...)`
- biomcgary 2y agoThank 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.
- ashvardanian 2y agoHow is the latency of calling purego bindings vs cgo? The latter seems prohibitively expensive for most of my projects.
- cyberax 2y agoI haven't checked (I make maybe 10 calls per second at most). Intuitively, they should be similar.
- biomcgary 2y agoIIRC, 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.