-
Notifications
You must be signed in to change notification settings - Fork 2
/
plugin.go
59 lines (45 loc) · 979 Bytes
/
plugin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
//#include <stdlib.h>
import "C"
import (
"fmt"
"unsafe"
)
const (
ifaceOK = iota
ifaceFail
)
var description *C.char
//export Load
func Load(_ unsafe.Pointer, factory1 unsafe.Pointer, factory2 unsafe.Pointer) bool {
fmt.Println("Go loading...")
description = C.CString("GoTest")
return true
}
//export Unload
func Unload(_ unsafe.Pointer) {
fmt.Println("Go unloading...")
C.free(unsafe.Pointer(description))
}
//export Description
func Description(_ unsafe.Pointer) *C.char {
return description
}
//export PutInServer
func PutInServer(_ unsafe.Pointer, player unsafe.Pointer, name *C.char) {
fmt.Printf("Go ClientPutInServer: %s\n", C.GoString(name))
}
//export CreateInterface
func CreateInterface(iface *C.char, ret *uint32) unsafe.Pointer {
if C.GoString(iface) == "ISERVERPLUGINCALLBACKS003" {
if ret != nil {
*ret = ifaceOK
}
return unsafe.Pointer(vptr)
}
if ret != nil {
*ret = ifaceFail
}
return nil
}
func main() {}