ebiten/internal/glfw/util_unix.go

21 lines
447 B
Go
Raw Normal View History

// SPDX-License-Identifier: Apache-2.0
// SPDX-FileCopyrightText: 2012 The glfw3-go Authors
// SPDX-FileCopyrightText: 2023 The Ebitengine Authors
2023-07-08 06:59:51 +02:00
//go:build darwin || freebsd || linux || netbsd || openbsd
package glfw
2023-07-07 19:16:39 +02:00
// #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) }
}