Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6940847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:48:22+00:00 2026-05-27T12:48:22+00:00

I use a custom build tool to compile go projects and I need a

  • 0

I use a custom build tool to compile go projects and I need a way to use cgo in my project.

The problem is that the cgo documentation only tells you how to use it with make.

What I really need to know is which generated files to process with which tools and in what order it needs to be done. I tried to read make.pkg in the go source dir but my best effort fails.

My test dll is very simple, a single function that returns 1 every time it is called and the go code to use this function is similarly simple.

The output from the console produced by a successful run of make on a cgo project would be very helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T12:48:22+00:00Added an answer on May 27, 2026 at 12:48 pm

    Output of running make on 32-bit Linux in directory misc/cgo/life:

    # gomake _obj/life.a
    CGOPKGPATH= cgo --  life.go 
    touch _obj/_cgo_run
    8g  -o _go_.8  _obj/life.cgo1.go _obj/_cgo_gotypes.go
    8c -FVw -I ${GOROOT}/pkg/linux_386 -I . -o "_cgo_defun.8" _obj/_cgo_defun.c
    gcc -m32 -I . -g -fPIC -O2 -o _cgo_main.o -c   _obj/_cgo_main.c
    gcc -m32 -g -fPIC -O2 -o c-life.o -c   c-life.c
    gcc -m32 -I . -g -fPIC -O2 -o life.cgo2.o -c   _obj/life.cgo2.c
    gcc -m32 -I . -g -fPIC -O2 -o _cgo_export.o -c   _obj/_cgo_export.c
    gcc -m32 -g -fPIC -O2 -o _cgo1_.o _cgo_main.o c-life.o life.cgo2.o _cgo_export.o  
    cgo -dynimport _cgo1_.o >_obj/_cgo_import.c_ && mv -f _obj/_cgo_import.c_ _obj/_cgo_import.c
    8c -FVw -I . -o "_cgo_import.8" _obj/_cgo_import.c
    rm -f _obj/life.a
    gopack grc _obj/life.a _go_.8  _cgo_defun.8 _cgo_import.8 c-life.o  life.cgo2.o _cgo_export.o
    

    The line cgo -- life.go creates the following files:

    _obj/_cgo_.o
    _obj/life.cgo1.go
    _obj/life.cgo2.c
    _obj/_cgo_gotypes.go
    _obj/_cgo_defun.c
    _obj/_cgo_main.c
    _obj/_cgo_flags
    _obj/_cgo_export.c
    _cgo_export.h
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using wordpress and use custom permalink structure: /%category%/%postname%/ My problem is that
I use a custom-built asp.net control that renders to a DIV and has height='0'
We use custom type to represent Identifiers in our project. It has TypeConvertor attached
I'd like to use custom build properties to drive the build process. Is it
I'm using JMX to build a custom tool for monitoring remote Coherence clusters at
I am attempting to use a custom workflow activity to auto-increment build numbers based
I want to use custom jsp tags to help build a menu in my
I need to let all projects in solution contain some additional build actions, e.g.
I want to integrate the execution of a custom tool to our build (say
Our applications use lot of custom built and third party libraries and right now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.