Re:Purego – A library for calling C functions from Go withou...
by nhooyr on Sunday February 12, 2023 @01:10PM
(#34765147)
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.
[ Parent
| on HN ]
Re:Purego – A library for calling C functions from Go withou...
by slimsag on Sunday February 12, 2023 @01:23PM
(#34765278)
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.
Re:Purego – A library for calling C functions from Go withou...
by totallygamerjet on Sunday February 12, 2023 @02:11PM
(#34765784)
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.
Re:Purego – A library for calling C functions from Go withou...
by ignoramous on Sunday February 12, 2023 @03:00PM
(#34766293)
I'll be on the lookout. Where's your blog / twitter? I don't see one linked to in your GitHub profile, either.
Re:Purego – A library for calling C functions from Go withou...
by totallygamerjet on Sunday February 12, 2023 @03:29PM
(#34766559)
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.
Re:Purego – A library for calling C functions from Go withou...
by ignoramous on Sunday February 12, 2023 @04:55PM
(#34767478)
Works. Thanks. Btw, if you haven't considered then, substack.com, hashnode.dev, dev.to are pretty good eng blogging platforms.
Re:Purego – A library for calling C functions from Go withou...
by mst on Monday February 13, 2023 @12:11AM
(#34770366)
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.)