package
Version:
v0.0.0-...-986f64f
Opens a new window with list of versions in this module.
Published: Jan 4, 2023
License: BSD-3-Clause
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
本包提供C语言功能的go语言API。
本包使用了cgo,编译需要cgo,在使用时请考虑这对交叉编译的影响!
C语言<stdlib.h>中提供的calloc函数的go语言API
C语言<stdlib.h>中提供的free函数的go语言API
C语言<stdlib.h>中提供的malloc函数的go语言API
//获得内存
ptr := Malloc(4)
//获取成败判断
if ptr != nil {
//失败处理
//......
}
//不用时释放获取的内存,避免内存泄露
defer Free(ptr)
//使用内存
//.......
Output:
C语言<string.h>中提供的memcpy函数的go语言API
C语言<stdlib.h>中提供的realloc函数的go语言API
Source Files
¶
Click to show internal directories.
Click to hide internal directories.