|
@@ -1,5 +1,23 @@
|
1
|
1
|
package sg
|
2
|
2
|
|
|
3
|
+/*
|
|
4
|
+#cgo amd64 386 CFLAGS: -DX86=1
|
|
5
|
+#cgo darwin,!arm,!arm64 LDFLAGS: -lpthread
|
|
6
|
+#cgo darwin,arm LDFLAGS: -framework CoreFoundation
|
|
7
|
+#cgo darwin,arm64 LDFLAGS: -framework CoreFoundation
|
|
8
|
+#cgo dragonfly LDFLAGS: -lpthread
|
|
9
|
+#cgo freebsd LDFLAGS: -lpthread
|
|
10
|
+#cgo android LDFLAGS: -llog
|
|
11
|
+#cgo !android,linux LDFLAGS: -lpthread
|
|
12
|
+#cgo netbsd LDFLAGS: -lpthread
|
|
13
|
+#cgo openbsd LDFLAGS: -lpthread
|
|
14
|
+
|
|
15
|
+#cgo CFLAGS: -Wall -Werror
|
|
16
|
+
|
|
17
|
+#cgo solaris CPPFLAGS: -D_POSIX_PTHREAD_SEMANTICS
|
|
18
|
+
|
|
19
|
+*/
|
|
20
|
+import "C"
|
3
|
21
|
import (
|
4
|
22
|
"archive/zip"
|
5
|
23
|
"bytes"
|
|
@@ -110,16 +128,22 @@ func (c *HisApiController) TestGetBasBaseInfo() {
|
110
|
128
|
s2 := []byte(string(str))
|
111
|
129
|
s3 := []byte(string(str1))
|
112
|
130
|
|
113
|
|
- ret2, _, err2 := readCard.Call((uintptr)(unsafe.Pointer(&s2[0])), IntPtr(256), (uintptr)(unsafe.Pointer(&s3[0])), IntPtr(256))
|
|
131
|
+ cData1 := C.CBytes(str)
|
|
132
|
+ cData2 := C.CBytes(str1)
|
|
133
|
+
|
|
134
|
+ ret2, _, err2 := readCard.Call((uintptr)(&cData1[0]), IntPtr(256), (uintptr)(&cData2[0]), IntPtr(256))
|
114
|
135
|
fmt.Println(" Add(4,5)的结果为:", ret2)
|
115
|
|
- fmt.Println(" str:", s2)
|
116
|
|
- fmt.Println(" str1:", s3)
|
|
136
|
+ fmt.Println(" str:", cData1)
|
|
137
|
+ fmt.Println(" str1:", cData2)
|
117
|
138
|
if err2 != nil {
|
118
|
139
|
fmt.Println("SSCard的运算结果为:", ret2)
|
119
|
140
|
c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
120
|
141
|
return
|
121
|
142
|
}
|
122
|
143
|
|
|
144
|
+ defer C.free(cData1)
|
|
145
|
+ defer C.free(cData2)
|
|
146
|
+
|
123
|
147
|
}
|
124
|
148
|
|
125
|
149
|
func (c *HisApiController) GetOrgInfo() {
|