Wrapping Go in Python
summary
Shows exactly how to compile a Go file into a shared object with go build -o name.so -buildmode=c-shared, load it from Python with ctypes.cdll and call the exported function by its exported name. Integers and floats round-trip with implicit or simple C type mapping, booleans appear as 0/1, strings require explicit conversion with C.CString/C.GoString and appear as bytes, and lists/dicts do not auto-convert. Example uses goroutines and channels to speed a prime counter; full code is on GitHub.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 0:34Github
- 1:07Talk Overview
- 1:31Section 1 It Can Be Done
- 3:59Shared Libraries
- 4:32Build
- 13:49Floats
- 14:07Prime Counter








