英文:
Having issues in linking objective-c with golang 1.1 - was working with golang 1.1beta
问题
需要帮助将Objective-C与Go链接起来。
以下Objective-C代码在golang 1.1beta中工作正常,但现在在最新的go 1.1版本中不起作用。
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
void
log(void) {
NSLog(@"from objective-c");
}
*/
import "C"
func New() {
C.log()
}
当我运行go install或go run <main.go路径>时,我得到以下错误:
(__DATA/__cfstring): dynamic symbol __CFConstantStringClassReference的重定位错误
(__DATA/__cfstring): __CFConstantStringClassReference的未处理重定位(类型28 rtype 120)
英文:
Need help with linking objective-c in go.
Following objective-c code was working with golang 1.1beta but now it doesn't work with the latest go 1.1 release.
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
void
log(void) {
NSLog(@"from objective-c");
}
*/
import "C"
func New() {
C.log()
}
I get following errors when I run go install or go run <path to main.go>:
(__DATA/__cfstring): unexpected reloc for dynamic symbol __CFConstantStringClassReference
(__DATA/__cfstring): unhandled relocation for __CFConstantStringClassReference (type 28 rtype 120)
答案1
得分: 1
报告了问题#5699,并在Go v1.2中修复了该问题。
英文:
Reported the issue #5699, and it got fixed in Go v1.2.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论