Thanks, Ian! I followed your advice and got it working. :) I did two things: imported the hello package, and compiled/linked everything using go-tool-compile/link instead of go-build command. The go-build command fails, because it passes the -complete flag to the compiler. I pushed the fix to the github repo if anyone is interested.
One thing I still don't understand is the cases when go:linkname is needed. Why not just import that package, if the function is exported. Is it only used for accessing unexported functions? On Thursday, February 9, 2017 at 7:53:43 PM UTC+3:30, Ian Lance Taylor wrote: > > On Thu, Feb 9, 2017 at 5:19 AM, Sina Siadat <sia...@gmail.com > <javascript:>> wrote: > > Thank you! > > > > To make sure I understand what is going on I tried to reproduce the same > > thing. But I can't get the compiler to find the definition of my > function > > even though I used the compiler directive here > > > > https://github.com/siadat/golinkname-test/blob/master/hello/hello.go#L6 > > > > I want to link the hello.hello and greet.hello functions. > > > > What am I doing wrong? > > You need to explicitly import your "hello" package. go:linkname can > link up names that are included in the link, but you need to make sure > that they are included in the link. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.