unsafe

package
v1.2.38 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CStringArray

func CStringArray(strs ...string) (**C.char, C.int)

CStringArray You can write as this directly.

// []string -> [](*C.char)
var strs []string
cCharArray := make([]*C.char, 0, len(strs))
for _, s := range strs {
	char := (*C.char)(unsafe.Pointer(C.CString(s)))
	cCharArray = append(cCharArray, char)
	defer C.free(unsafe.Pointer(char)) //释放内存
}
var cstr **C.char
var cstrSize C.int
cstr = (**C.char)(unsafe.Pointer(&cCharArray[0]))
cstrSize =  C.int(len(strs))

func GoStringArray

func GoStringArray(strArray unsafe.Pointer, n int) []string

GoStringArray char** -> []string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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