Hi,
i am trying to write a code, where i call Go API to return a value.
i am making use of portstatus.c example in the examples/dp/find_next directory.
i have written a gofile.
myfunc.go
did -> go build -buildmode=c-shared -o myfunc.a myfunc.go
the above command generated .a file(library) and myfunc.h file
i included this .h header file in portstatus.c code
and tried calling the func get_entry defined in myfunc.go
when i did make all
i got this error
root@mars01> make all
cc -o portstatus portstatus.o /opt/confd//lib/libconfd.a -lpthread -lm
portstatus.o: In function get_elem': /opt/confd/examples.confd/dp/find_next/portstatus.c:181: undefined reference to
get_entry’
collect2: error: ld returned 1 exit status
i was supposed to link the static library using
gcc -o portstatus portstatuc.c myfunc.a
this gave me a error
root@mars01> gcc -o portstatus portstatus.c gofunc.a
portstatus.c:14:23: fatal error: confd_lib.h: No such file or directory
#include <confd_lib.h>
^
compilation terminated.
Can someone let me know the steps in how to make use of GO functions in C and how to compile it
Thanks in Advance
Roopa