/altv-go

Go support for alt:V Multiplayer.

Primary LanguageC++MIT LicenseMIT

alt:V Go

license

Get started   •   Docs   •   alt:V   •   Discord   •   Twitter

Go package for alt:V Multiplayer. Runtime can be found here.

Requirements

Package depends heavily on cgo. To build on Windows, a gcc compiler is required (ex: mingw-w64).

Usage

Main function is left blank on purpose and must be included before building process. Do not try to initialize stuff inside as it won't get called.

package main

import "C"
import "github.com/timo972/altv-go/api/alt"

func init() {
	// You may want to initialize something here
}

func main() {
	// You dont want to initialize something here because this wont work
}

//export OnStart
func OnStart() {
	alt.LogInfo("Resource Started")
}

//export OnStop
func OnStop() {
	alt.LogInfo("Resource Stopped")
}

Build

Windows

go build -o my-resource.dll -buildmode=c-shared

Linux (currently broken)

export CGO_LDFLAGS="-g -ldl"
go build -o my-resource.so -buildmode=c-shared