Re: [go-nuts] How to compile a go program which uses cgo to llvm IR?

2021-06-10 Thread Ian Lance Taylor
On Wed, Jun 9, 2021 at 11:27 PM Peng Deng wrote: > > Hi, I have the following program > > package main > > /* > #include > > static void SayHello(const char* s) { > puts(s); > } > */ > import "C" > > func main() { > C.SayHello(C.CString("Hello, World\n")) > } > > I want to compile this pr

Re: [go-nuts] How to compile a go program which uses cgo to llvm IR?

2021-06-10 Thread 'Than McIntosh' via golang-nuts
Hello, As described in https://go.googlesource.com/gollvm/#seetheir, you will generally want to run "go build" in order to see the correct invocation of llvm-goc for your use case. In your case (building a Go file that uses CGO), there is a lot happening "under the hood" when you do the build --

[go-nuts] How to compile a go program which uses cgo to llvm IR?

2021-06-09 Thread Peng Deng
Hi, I have the following program package main /* #include static void SayHello(const char* s) { puts(s); } */ import "C" func main() { C.SayHello(C.CString("Hello, World\n")) } I want to compile this program to LLVM IR with gollvm, the compilation instruction is as follows: llvm-goc