Creating c-archive that uses external symbols

65 views
Skip to first unread message

Aviram Hassan

unread,
Nov 9, 2022, 1:31:10 PM11/9/22
to golang-nuts
Hi,
I wish to create a c-archive that contains only specific symbols, importing on runtime the needed symbols.
I managed to create a `.o` file that I believe contains only my functions using
`go tool compile -shared -dynlink main.go`
but then when I do
`go tool link -buildmode=c-archive -extld clang -extldflags='-undefined dynamic_lookup' -installsuffix /tmp -o main.a main.o`
It tries to find all the runtime stuff I want it to link at runtime.
Thanks in advance,
Aviram

Jason E. Aten

unread,
Nov 13, 2022, 3:54:25 AM11/13/22
to golang-nuts
All go code depends on the runtime for memory and go routine management, so the runtime will always have to be included.
Reply all
Reply to author
Forward
0 new messages