From 981ca0fa022524fd04af988bc798f2d697d31548 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 19 五月 2021 14:33:10 +0800
Subject: [PATCH] hide .so symbols, avoid 2+ protobuf link conflict.
---
api/bhsgo/bhome_node.go | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/api/bhsgo/bhome_node.go b/api/bhsgo/bhome_node.go
index f771f08..2cf3a81 100644
--- a/api/bhsgo/bhome_node.go
+++ b/api/bhsgo/bhome_node.go
@@ -4,7 +4,7 @@
#include "bh_api_go.h"
*/
-// #cgo LDFLAGS: -L/home/lichao/code/shmsg/build/lib -L/usr/local/lib -lbhome_shmq -lbhome_msg -lprotobuf-lite -lstdc++ -lpthread -lrt
+// #cgo LDFLAGS: -L/home/lichao/code/shmsg/build/lib -L/usr/local/lib -lbhome_shmq -lstdc++ -lpthread -lrt
import "C"
import (
@@ -61,12 +61,13 @@
return bhApiIn1Out1(C.FBHApiIn1Out1(C.BHUnregister), data, reply, timeout_ms)
}
-func QueryTopicAddress(topic *bh.MsgQueryTopic, reply *bh.MsgQueryTopicReply, timeout_ms int) bool {
+func QueryTopicAddress(dest_addr *bh.BHAddress, topic *bh.MsgQueryTopic, reply *bh.MsgQueryTopicReply, timeout_ms int) bool {
+ dest, _ := dest_addr.Marshal()
data, _ := topic.Marshal()
creply := unsafe.Pointer(nil)
creply_len := C.int(0)
defer C.BHFree(creply, creply_len)
- r := C.BHQueryTopicAddress(getPtr(&data), C.int(len(data)), &creply, &creply_len, C.int(timeout_ms)) > 0
+ r := C.BHQueryTopicAddress(getPtr(&dest), C.int(len(dest)), getPtr(&data), C.int(len(data)), &creply, &creply_len, C.int(timeout_ms)) > 0
if r {
reply.Unmarshal(C.GoBytes(creply, creply_len))
}
@@ -152,6 +153,10 @@
}
+func Cleanup() {
+ C.BHCleanup()
+}
+
type ServerCB func(src unsafe.Pointer, proc_id *string, req *bh.MsgRequestTopic)
type ClientCB func(proc_id *string, msg_id *[]byte, reply *bh.MsgRequestTopicReply)
type SubDataCB func(proc_id *string, pub *bh.MsgPublish)
--
Gitblit v1.8.0