Hacker News new | ask | show | jobs
by nhooyr 1219 days ago
An explanation of how this works and what makes it novel would be nice. I'm not familiar enough to understand how this is better than Cgo.
2 comments

It loads the dynamic library at runtime, instead of linking against it, which means it makes cross-compiling with CGO easier as no target C toolchain is needed.
What slimsag wrote is correct. It makes cross-compiling code that needs to call C functions as easy a setting the GOOS and GOARCH and just building. This means no need to worry about building a C cross-compiler.

I do want to write an article about how purego works under the hood.

I'll be on the lookout. Where's your blog / twitter? I don't see one linked to in your GitHub profile, either.
I don't have either. I was gonna figure out how to post it after I actually sat down and wrote it lol. I'll probably post it in the golang subreddit and maybe link to it in the README.md since it describes how purego works.
Works. Thanks. Btw, if you haven't considered then, substack.com, hashnode.dev, dev.to are pretty good eng blogging platforms.
If memory serves, dev.to tends to be downranked or outright filtered by a bunch of places.

(I have no idea how or why that came about, I've merely observed people having all sorts of trouble getting posts on there visible in aggregators and etc.)