第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用 Go 1.5 buildmode=c-archive 和從 C 鏈接的

使用 Go 1.5 buildmode=c-archive 和從 C 鏈接的

Go
人到中年有點(diǎn)甜 2021-10-18 10:28:35
即將發(fā)布的 Go 1.5 帶有新的構(gòu)建模式,允許導(dǎo)出要從 C 代碼鏈接和調(diào)用的 Go 符號。我一直在玩它,并獲得了基本的“Hello world”示例,但現(xiàn)在我正在嘗試鏈接一個(gè) Go 庫,它啟動(dòng)了 anet/http.Server并且它失敗了。代碼如下所示(也可在此處獲得):gohttplib.go:package mainimport "C"import "net/http"//export ListenAndServefunc ListenAndServe(caddr *C.char) {    addr := C.GoString(caddr)    http.ListenAndServe(addr, nil)}func main() {}示例/c/main.c:#include <stdio.h>#include "../../gohttplib.h"int main(){    ListenAndServe(":8000");    return 0;}生成靜態(tài)鏈接的對象和標(biāo)題工作正常:$ go build -buildmode=c-archive但是針對它進(jìn)行編譯失敗了:$ gcc -o gohttp-c examples/c/main.c gohttplib.a -lpthreadUndefined symbols for architecture x86_64:  "_CFArrayGetCount", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)  "_CFArrayGetValueAtIndex", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)  "_CFDataAppendBytes", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)  "_CFDataCreateMutable", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)  "_CFDataGetBytePtr", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)      __cgo_6dbb806e9976_Cfunc_CFDataGetBytePtr in gohttplib.a(000003.o)     (maybe you meant: __cgo_6dbb806e9976_Cfunc_CFDataGetBytePtr)  "_CFDataGetLength", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)      __cgo_6dbb806e9976_Cfunc_CFDataGetLength in gohttplib.a(000003.o)     (maybe you meant: __cgo_6dbb806e9976_Cfunc_CFDataGetLength)  "_CFRelease", referenced from:      _FetchPEMRoots in gohttplib.a(000003.o)      __cgo_6dbb806e9976_Cfunc_CFRelease in gohttplib.a(000003.o)     (maybe you meant: __cgo_6dbb806e9976_Cfunc_CFRelease)這是在 OS X 10.9.5 上使用 Go github 存儲(chǔ)庫 (38e3427) 中的最新版本。我知道 Go 1.5 還沒有發(fā)布,并且不能保證它可以工作,但我這樣做是出于教育目的,我懷疑我遺漏了一些東西。
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 329 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號