On Wed, Jun 9, 2021 at 11:27 PM Peng Deng <dws...@outlook.com> wrote:
>
> Hi, I have the following program
>
> package main
>
> /*
> #include <stdio.h>
>
> 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 -emit-llvm -c -O0 goc.go -o goc.bc
>
> The errors are as follows:
>
> goc.go:10:9: error: import file 'C' not found
> goc.go:13:5: error: reference to undefined name 'C'
> goc.go:13:16: error: reference to undefined name 'C'
>
> What's wrong with my compilation instruction? How could I compile this 
> program to LLVM IR?
>
> I would appreciate it if someone could help me.

Running llvm-goc is the equivalent of running "go tool compile".  It's
rarely what you want to do.  You should run the go tool, which is
probably named llvm-go.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWAYt8ZoHnkx%3DTNm3mUACYJJs18TKjteP0U9ciFSFQVSw%40mail.gmail.com.

Reply via email to