Go package for alt:V Multiplayer. Runtime can be found here.
Package depends heavily on cgo. To build on Windows, a gcc compiler is required (ex: mingw-w64).
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")
}
go build -o my-resource.dll -buildmode=c-shared
export CGO_LDFLAGS="-g -ldl"
go build -o my-resource.so -buildmode=c-shared