Its not defining the functions Ian. The issue is both the packages A and B
are linking the same library
package A:
/*
#cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
*/
The same thing in package B:
/*
#cgo LDFLAGS: -Bstatic ${SRCDIR}/../lib/libeventbridge.a
*/
Please note:
1. Without including the library in these packages, the linker of the
individual package fails indicating that the definition of the functions
used is not found.
2. Package B imports package A
Thanks,
Sriram
On Saturday, October 29, 2016 at 5:25:05 PM UTC+5:30, Ian Lance Taylor
wrote:
>
> On Fri, Oct 28, 2016 at 9:36 PM, <[email protected] <javascript:>>
> wrote:
> >
> >>go build
> > # agent
> > /<path>/goLang/go/pkg/tool/linux_amd64/link: running gcc failed: exit
> status
> > 1
> > /<path>/tmp/go-link-022070709/000001.o: In function `putStringToBuffer':
> > /<path>/goLang/goCode/src/eventbridge/EventBridge.c:31: multiple
> definition
> > of `putStringToBuffer'
> >
> /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:31:
>
>
> > first defined here
> > /<path>/tmp/go-link-022070709/000001.o: In function
> `ReceiveEventBuffer':
> > /<path>/goLang/goCode/src/eventbridge/EventBridge.c:446: multiple
> definition
> > of `ReceiveEventBuffer'
> >
> /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:446:
>
>
> > first defined here
> > /<path>/tmp/go-link-022070709/000001.o: In function
> `getStringFromBuffer':
> > /<path>/goLang/goCode/src/eventbridge/EventBridge.c:37: multiple
> definition
> > of `getStringFromBuffer'
> >
> /<path>/tmp/go-link-022070709/000000.o:/<path>/goLang/goCode/src/eventbridge/EventBridge.c:37:
>
>
> > first defined here
>
> This looks like your cgo comment, before the import "C", is actually
> defining functions rather than simply declaring them. What does the
> cgo comment look like?
>
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.