go build -x -v -ldflags "-s -w" -buildmode=c-archive -o GoServer.a GoServer.go
package main
import "C"
//export verifyLicense
func verifyLicense() {
fmt.Println("hello from golang")
}
cmake
add_library(libGoServer STATIC IMPORTED )
set_target_properties(libGoServer PROPERTIES
IMPORTED_LOCATION "${CMAKE_SOURCE_DIR}/GoServer.a")
add_executable(ABOCRServer ${SOURCE_FILES})
target_link_libraries(ABOCRServer ${OpenCV_LIBS} iphlpapi libGoServer)
有疑问加站长微信联系(非本文作者)