2023-07-07 19:15:47 +02:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
// 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
|
2023-07-05 03:51:55 +02:00
|
|
|
|
2023-07-21 18:02:55 +02:00
|
|
|
package cglfw
|
2023-07-05 03:51:55 +02:00
|
|
|
|
2023-07-07 19:16:39 +02:00
|
|
|
// #include <stdlib.h>
|
2023-07-05 03:51:55 +02:00
|
|
|
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) }
|
|
|
|
}
|