mirror of
https://github.com/libretro/go-nanoarch.git
synced 2024-11-27 10:30:35 +00:00
Load a libretro core
This commit is contained in:
parent
061104d497
commit
bcfa58b538
18
nanoarch.go
18
nanoarch.go
@ -9,17 +9,35 @@ import (
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"unsafe"
|
||||
|
||||
"github.com/go-gl/gl/v4.1-core/gl"
|
||||
"github.com/go-gl/glfw/v3.2/glfw"
|
||||
)
|
||||
|
||||
/*
|
||||
#include "libretro.h"
|
||||
#cgo LDFLAGS: -ldl
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <dlfcn.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
func init() {
|
||||
// GLFW event handling must run on the main OS thread
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
cstr := C.CString("snes9x_libretro.dylib")
|
||||
defer C.free(unsafe.Pointer(cstr))
|
||||
h := C.dlopen(cstr, C.RTLD_NOW)
|
||||
if h == nil {
|
||||
log.Fatalf("error loading %s\n", C.GoString(cstr))
|
||||
}
|
||||
|
||||
if err := glfw.Init(); err != nil {
|
||||
log.Fatalln("failed to initialize glfw:", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user