The gccgo compiler does not currently (2015-06-15) record the file name of imported packages in the object file. You must arrange for the imported data to be linked into the program. Again, this is not necessary when building with the go command.

gccgo -c mypackage.go              # Exports mypackage
gccgo -c main.go                   # Imports mypackage
gccgo -o main main.o mypackage.o   # Explicitly links with mypackage.o
FILE.gox, when used, will typically contain nothing but export data. This can be generated from FILE.o via

objcopy -j .go_export FILE.o FILE.gox
The C function naturally expects a NUL-terminated string, which in Go is equivalent to a pointer to an array (not a slice!) of byte with a terminating zero byte. So a sample call from Go would look like (after importing the syscall package):

var name = [4]byte{'f', 'o', 'o', 0};
i := c_open(&name[0], syscall.O_RDONLY, 0);

Recommend

Go Setting up and using gccgo Imports

Go Setting up and using gccgo Using gccgo

Go Setting up and using gccgo Building Build commands

Setting up and using gccgo Building Gold

Installing Go from source Optional environment variables

Installing Go from source Keeping up with releases

Installing Go from source Install additional tools

Installing Go from source Testing your installation

Installing Go from source Install Go

Installing Go from source (Optional) Switch to the master branch

Installing Go from source Fetch the repository

Installing Go from source Install Go compiler binaries for bootstrap Bootstrap toolchain using gccgo

Installing Go from source Install Go compiler binaries for bootstrap Bootstrap toolchain from cross-compiled source

Go Managing dependencies Specifying a module proxy server

Go Managing dependencies Removing a dependency

Go Managing dependencies Getting a specific commit using a repository identifier

Go Managing dependencies Developing and testing against unpublished module code Requiring external module code from your own repository fork

Go Managing dependencies Developing and testing against unpublished module code Requiring module code in a local directory

Go Managing dependencies Synchronizing your code’s dependencies

Go Managing dependencies Discovering available updates

Go Managing dependencies Getting a specific dependency version

Go Managing dependencies Adding a dependency

Go Managing dependencies Naming a module

Go Managing dependencies Enabling dependency tracking in your code

Go Managing dependencies Locating and importing useful packages

Go Module version numbering Major version Example

Go Module version numbering Patch version Example

Go Module version numbering Minor version Example

Go Module version numbering Pre-release version Example

Go Managing module source Organizing code in the repository

Go go.mod file reference retract Notes

Go go.mod file reference retract Example

Go go.mod file reference retract Syntax

Go go.mod file reference exclude Notes

Go go.mod file reference exclude Example

Go go.mod file reference exclude Syntax

Go go.mod file reference replace Notes

Go go.mod file reference replace Examples

Go go.mod file reference replace Syntax

Go go.mod file reference require Syntax

Go go.mod file reference go Syntax

Go go.mod file reference module Notes

Go go.mod file reference module Examples

Go go.mod file reference module Syntax

Go go.mod file reference Example

Go go.mod file reference

Go Publishing a module Publishing steps

Go Developing a major version update Branching for a major release

Go Module release and versioning workflow Publishing breaking API changes

Go Module release and versioning workflow Publishing the first stable version

Go Module release and versioning workflow Publishing the first (unstable) version

Go Module release and versioning workflow Publishing pre-release versions

Go Contribution Guide Miscellaneous topics Sending multiple dependent changes

Go Contribution Guide Miscellaneous topics Set up git aliases

Go Contribution Guide Miscellaneous topics Reviewing code by others

Go Contribution Guide Miscellaneous topics Synchronize your client

Go Contribution Guide Miscellaneous topics Specifying a reviewer / CCing others

Go Contribution Guide Miscellaneous topics Quickly testing your changes

Go Contribution Guide Miscellaneous topics Troubleshooting mail errors

Go Contribution Guide Miscellaneous topics Copyright headers

Contribution Guide Good commit messages

Go Contribution Guide Sending a change via Gerrit Step 5: Revise changes after a review

Go Contribution Guide Sending a change via Gerrit Step 4: Send changes for review

Go Contribution Guide Sending a change via Gerrit Step 3: Test your changes In the golang.org/x/... repositories