Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
Coffer 0.0.2 ============ Small package for copying between a memory range managed by C code and Go Buffers. Requires installation of github.com/boggle/gonewrong Status: Only barely tested right now but it appears to be working :-) Typical Usage: import buffer import unsafe.coffer import io var start uintptr var sz int var buf io.Buffer coffer := coffer.NewPtrCoffer(start, sz) // Read Bytes from C buf.ReadFrom(coffer) bytes := buf.Bytes() // Write Bytes to C buf.WriteTo(coffer) // or coffer.Write(buf.Bytes()) // Reset to start of memory range coffer.Seek(0, 0) // Subsequent Read, Write, or Seek will fail // Does *NOT* free coffer.Close() // Variant: Allocs using C.malloc and frees on Close() // (independent from Go's GC) coffer := coffer.NewMemCoffer(sz) Coffer.Close() // Have fun!