convc

package
v0.0.0-...-f4ac04f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToC

func BytesToC(b []byte) (p *uint8, free func())

Copy the given byte slice to a newly Malloc'd C string.

func BytesToPointer

func BytesToPointer(b []byte) *uint8

Convert the given byte slice to a byte pointer.

func BytesToString

func BytesToString(b []byte) string

Reverse of StringToBytes.

Directly convert a byte slice to a string. This is highly unsafe, do not modify the original slice!

func Malloc

func Malloc(size int) (bytes []byte, free func())

Malloc the given number of bytes. The resulting memory is not known to the Go garbage collector. Call the resulting free function to deallocate the allocated memory.

func MultiStringToC

func MultiStringToC(ss ...string) (p **uint8, free func())

Copy the given strings to a newly Malloc'd C buffer. It returns a list of nul-terminated C strings.

func PointerToBytes

func PointerToBytes(p *uint8, size int) []byte

Convert the given pointer and size to a byte slice. This is highly unsafe.

func PointerToString

func PointerToString(p *uint8, size int) string

Convert the given pointer and size to a string. This is highly unsafe.

func StringToBytes

func StringToBytes(s string) []byte

Directly convert a string to a byte slice. This is highly unsafe, do not modify the resulting slice!

func StringToC

func StringToC(s string) (p *uint8, free func())

Copy the given string to a newly Malloc'd C string.

func StringToPointer

func StringToPointer(s string) *uint8

Convert the given string to a byte pointer. This is highly unsafe.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL