MCPcopy Create free account
hub / github.com/golang/mobile / cStringPtr

Method cStringPtr

gl/work.go:165–173  ·  view source on GitHub ↗

cStringPtr creates a pointer to a C string off the Go heap. ret is a **char.

(str string)

Source from the content-addressed store, hash-verified

163// cStringPtr creates a pointer to a C string off the Go heap.
164// ret is a **char.
165func (ctx *context) cStringPtr(str string) (uintptr, func()) {
166 s, free := ctx.cString(str)
167 ptr := C.malloc(C.size_t(unsafe.Sizeof((*int)(nil))))
168 *(*uintptr)(ptr) = s
169 return uintptr(ptr), func() {
170 free()
171 C.free(ptr)
172 }
173}

Callers 2

ShaderSourceMethod · 0.95
ShaderSourceMethod · 0.95

Calls 1

cStringMethod · 0.95

Tested by

no test coverage detected