Hacker GitHub

← All repos

ebitengine/purego

View on GitHub ↗ ★ 4,080 Assembly

A library for calling C functions from Go without Cgo

16 mentions on Hacker News by 12 people: 3 stories, 13 comments · first 2023-02-12 · latest 2026-07-07

Mentions per year 16 mentions · busiest year 2025 (6)
20082026
  1. ▲ 1
    purego: A library for calling C functions from Go without Cgo
    story by eatonphil · 2026-07-07 · 0 comments
  2. …in Go. Most of the time I have found calling C from Go faster or on par with calling C from Python. https://github.com/ebitengine/purego
    comment by impulser_ · 2026-05-08 · in Just Use Go
  3. If you want to avoid Cgo, you can use https://github.com/ebitengine/purego or Goffi to call the native functions. It's a bit cursed, but works.
  4. …or less the same issues as CGo [4]. [1]: https://www.erlang.org/doc/system/nif.html [2]: https://pkg.go.dev/github.com/ebitengine/purego [3]: https://erlang.org/documentation/doc-10.1/doc/efficiency_gui... [4]:…
  5. …tried lots of things in the past but not using Alpine which is a great idea Another alternative is https://github.com/ebitengine/purego You can use this to dynamic load shared objects / DLLs so in the OP example they could disable systemd…
    comment by nickcw · 2025-12-13 · in Go is portable, until it isn't
  6. Cgo is terrible, but if you just want some simple C calls from a library, you can use https://github.com/ebitengine/purego to generate the bindings. It is a bit cursed, but works pretty well. I'm using it in my hardware-backed KMIP server…
    comment by cyberax · 2025-12-13 · in Go is portable, until it isn't
  7. …not sure how many other people have gotten the memo (HostLayout didn't exist before Go 1.23). [1]: https://github.com/ebitengine/purego/issues/259
    comment by kbolino · 2025-04-01 · in Go Optimization Guide
  8. ▲ 2
    Purego: A library for calling C functions from Go without Cgo
    story by johnmaguire · 2025-03-31 · 0 comments
  9. …call into C, and the same performance is expected. I'm not the one saying this, read the authors: https://github.com/ebitengine/purego/issues/202 wazero uses a different mechanism, the one used to call Go assembly, but adds its own…
    comment by ncruces · 2025-02-27 · in Calling Rust from Cursed Go
  10. It’s using purego: https://github.com/ebitengine/purego And linking against libtcl and libtk.
  11. …Go but also C. I mean, even on platforms without cgo, it's it working magically? No; it's using https://github.com/ebitengine/purego , which is: > A library for calling C functions from Go without Cgo. Like... I mean.... okaaaay, it's not…
    comment by wokwokwok · 2024-08-13 · in Go is my hammer, and everything is a nail
  12. …you commonly need to cgo into ld.so to use dynamic linking. But there's this if you wanna try: https://github.com/ebitengine/purego
  13. …we discuss DNS and LDAP, nsswitch here: A library for calling C functions from Go without Cgo. https://github.com/ebitengine/purego https://news.ycombinator.com/item?id=34763681
  14. …my use cases those approaches worked perfectly, CGO free. [1] https://github.com/Binject/debug [2] https://github.com/ebitengine/purego
    comment by cookiengineer · 2023-03-23 · in The simplicity of single-file Golang deployments
  15. …do in the identifiers? Are they just "name mangling" to keep them from being exported or something? https://github.com/ebitengine/purego/blob/v0.2.0-alpha/sys_d... I noticed another 0xB7 character in a comment, and sure enough it seems to…
  16. ▲ 268
    Purego – A library for calling C functions from Go without Cgo
    story by weitzj · 2023-02-12 · 69 comments