ebiten/internal/glfw/util_unix.go
2023-10-07 23:59:55 +09:00

21 lines
447 B
Go

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2012 The glfw3-go Authors
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
//go:build darwin || freebsd || linux || netbsd || openbsd
package glfw
// #include <stdlib.h>
import "C"
func bytes(origin []byte) (pointer *uint8, free func()) {
n := len(origin)
if n == 0 {
return nil, func() {}
}
ptr := C.CBytes(origin)
return (*uint8)(ptr), func() { C.free(ptr) }
}