-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/cgo: Unable to use godefs with Objective-C #23615
Comments
The cgo tool works with C, not Objective C. Sorry. |
As far as I understand Objective-C translates to C code and this is why GoLang C package can work with Objective-C. And it looks inconsistent that godefs tools can not do this. Looks like (I'm not sure) that godefs just use wrong/ignore some compile options. |
It may well be that it sometimes works. Let me put it this way: we only support using the cgo tool with C, not Objective C. And I will add that the What are you really trying to do? |
I need to pass variable of type T from Go code to Objective-C code. T is structure. So I need to create compatible (in terms of memory layout) type/variable in GoLang and pass it to Objective-C via unsafe.Pointer casting. For generic C code I use godefs in such cases. |
I see. I don't think there is a way to do that if the type is only defined in Objective C. |
I see that godefs compile source to extract information about type (I would like to say that godefs does not parse source directly). If so then whats the diffences C code or Objective-C code if last converted to C code? |
I'm sorry, I don't know what the difference is. I see that you tried it, and that it doesn't work. I know for sure that we do not want to take on the burden of supporting Objective C going forward. I understand that it would be useful for you. |
Finally I found a solution. It is possible to do what I want. The only thing I missed:
output:
|
Please answer these questions before submitting your issue. Thanks!
go version go1.10rc1 darwin/amd64
(the same with 1.9.3)I try to
go tool cgo -godefs cgodefs.go
wherecgodefs.go
containsand I expect to see source with compatible CGPoint structure. Instead of it I receive a lot of compilation errors:
On the other hand I can successfully build and run GoLang app with Objective-C code.
The text was updated successfully, but these errors were encountered: