cStringPtr creates a pointer to a C string off the Go heap. ret is a **char.
(str string)
| 163 | // cStringPtr creates a pointer to a C string off the Go heap. |
| 164 | // ret is a **char. |
| 165 | func (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 | } |
no test coverage detected