'How to export function from different package of go into static library so that I can call it from a cpp program

I have a main package and a string package in go.

In main.go (main package)I have one //export function and

In string.go(string package) I have another //export function.

When I run "go build -buildmode=c-archive" I see that the header file generated has only declaration of main package functions and it does not include any //export functions from string package.

Any suggestion would be helpful. Thanks in advance.

go


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source