6

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 :

(__DATA/__cfstring): unexpected reloc for dynamic symbol __CFConstantStringClassReference
(__DATA/__cfstring): unhandled relocation for __CFConstantStringClassReference (type 28 rtype 120)
vorak
  • 221
  • 2
  • 6
  • This seems to be a on going issue. See https://code.google.com/p/go/issues/detail?id=1781 and https://code.google.com/p/go/issues/detail?id=4069 – Larry Battle Oct 30 '13 at 19:09

1 Answers1

1

Reported the issue #5699, and it got fixed in Go v1.2.

vorak
  • 221
  • 2
  • 6