mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-14 15:07:26 +01:00
120366c3ac
Updates #2695
21 lines
448 B
Go
21 lines
448 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 cglfw
|
|
|
|
// #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) }
|
|
}
|