5d9cf01c
zhangqijia
plugin 热更
|
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
|
package main
import (
"fmt"
"os"
"plugin"
"pro2d/src/components/net"
)
func main() {
p, err := plugin.Open("./bin/plugin.so")
if err != nil {
fmt.Println("error open plugin: ", err)
os.Exit(-1)
}
s, err := p.Lookup("IamPluginA")
if err != nil {
fmt.Println("error lookup IamPluginA: ", err)
os.Exit(-1)
}
pkg1 := net.MsgPkg{
Head: &net.Head{
Length: 16,
Cmd: 0,
ErrCode: 0,
},
}
if x, ok := s.(func(net.MsgPkg)); ok {
x(pkg1)
}
}
|