Package for copying data between memory ranges managed by C code and Go Buffers (uses cgo)
License
boggle/coffer
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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!
About
Package for copying data between memory ranges managed by C code and Go Buffers (uses cgo)
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published