Skip to content

Instantly share code, notes, and snippets.

@BenLubar

BenLubar/cgo.go Secret

Last active October 18, 2018 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BenLubar/089abe8fd044c1b908bf9969b7f79edc to your computer and use it in GitHub Desktop.
Save BenLubar/089abe8fd044c1b908bf9969b7f79edc to your computer and use it in GitHub Desktop.
// +build windows,amd64,cgo
package main
/*
#cgo LDFLAGS: -L ${SRCDIR} -lsteam_api64
#include <stdbool.h>
#include <stdint.h>
bool SteamAPI_Init();
void SteamAPI_Shutdown();
*/
import "C"
func SteamAPI_Init() bool {
return bool(C.SteamAPI_Init())
}
func SteamAPI_Shutdown() {
C.SteamAPI_Shutdown()
}
module gist.github.com/089abe8fd044c1b908bf9969b7f79edc
package main
func main() {
if !SteamAPI_Init() {
panic("failed to initialize Steam API")
}
defer SteamAPI_Shutdown()
// game would go here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment