Skip to content

Commit 526e29c

Browse files
authored
Merge pull request #30 from focusingly/win64-fix
解决 windows 开发环境下 cgo 依赖的问题
2 parents c5346aa + 467e4b7 commit 526e29c

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

config_win64.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
package iec61850
44

55
// #cgo CFLAGS: -I./libiec61850/inc/hal/inc -I./libiec61850/inc/common/inc -I./libiec61850/inc/goose -I./libiec61850/inc/iec61850/inc -I./libiec61850/inc/iec61850/inc_private -I./libiec61850/inc/logging -I./libiec61850/inc/mms/inc -I./libiec61850/inc/mms/inc_private -I./libiec61850/inc/mms/iso_mms/asn1c
6-
// #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L./libiec61850/lib/win64 -liec61850 -lws2_32
6+
// #cgo LDFLAGS: -static-libgcc -static-libstdc++ -L${SRCDIR}/libiec61850/lib/win64 -liec61850 -lhal -lws2_32
77
import "C"

libiec61850/lib/win64/libhal.a

537 KB
Binary file not shown.

libiec61850/lib/win64/libiec61850.a

-3.59 MB
Binary file not shown.

mms.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ package iec61850
44
import "C"
55
import (
66
"fmt"
7-
"github.com/spf13/cast"
87
"unsafe"
8+
9+
"github.com/spf13/cast"
910
)
1011

1112
func toMmsValue(mmsType MmsType, value interface{}) (*C.MmsValue, error) {
@@ -114,8 +115,8 @@ func toGoValue(mmsValue *C.MmsValue, mmsType MmsType) (interface{}, error) {
114115
}
115116

116117
func toGoStructure(mmsValue *C.MmsValue, mmsType MmsType) ([]*MmsValue, error) {
117-
if mmsType != Structure {
118-
return nil, nil
118+
if !(mmsType == Structure || mmsType == Array) {
119+
return nil, fmt.Errorf("require struct or array type value, but got type code is: %d", mmsType)
119120
}
120121

121122
mmsValues := make([]*MmsValue, 0)

0 commit comments

Comments
 (0)