SkillAgentSearch skills...

Coffer

Package for copying data between memory ranges managed by C code and Go Buffers (uses cgo)

Install / Use

/learn @boggle/Coffer
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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!

View on GitHub
GitHub Stars8
CategoryDevelopment
Updated10y ago
Forks0

Languages

Go

Security Score

55/100

Audited on Apr 25, 2015

No findings