initial commit

This commit is contained in:
NeilClack
2026-08-07 14:51:41 -05:00
commit 9251b3a196
604 changed files with 464448 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package sdl
// #include "sdl_wrapper.h"
import "C"
import "unsafe"
// SharedObject is a pointer to the object handle.
type SharedObject uintptr
// LoadObject dynamically loads a shared object and returns a pointer to the object handle.
// (https://wiki.libsdl.org/SDL_LoadObject)
func LoadObject(sofile string) SharedObject {
_sofile := C.CString(sofile)
defer C.free(unsafe.Pointer(_sofile))
return (SharedObject)(C.SDL_LoadObject(_sofile))
}
// LoadFunction returns a pointer to the named function from the shared object.
// (https://wiki.libsdl.org/SDL_LoadFunction)
func (handle SharedObject) LoadFunction(name string) unsafe.Pointer {
_name := C.CString(name)
defer C.free(unsafe.Pointer(_name))
return (unsafe.Pointer)(C.SDL_LoadFunction((unsafe.Pointer)(handle), _name))
}
// Unload unloads a shared object from memory.
// (https://wiki.libsdl.org/SDL_UnloadObject)
func (handle SharedObject) Unload() {
C.SDL_UnloadObject((unsafe.Pointer)(handle))
}