I made a C program. And I made a go file with go functions defined. In the C program, I called go functions. Is go called from C compiled or interpretted?
-
4Go is always compiled. – Volker Apr 01 '15 at 06:22
-
@Volker [Is it?](https://github.com/sbinet/go-eval) – autistic Apr 01 '15 at 06:39
-
1@undefinedbehaviour: please stop. you're comments are not helpful, and that link goes nowhere. No one is asking about alternative implementations, of course they could do something differently. – JimB Apr 01 '15 at 13:18
-
@JimB Sorry. I was merely providing evidence to the contrary of the invalid assertion. I'm sure it'd be better if people went about their way ignorant of the truth. Probably more helpful, too. – autistic Apr 01 '15 at 14:29
3 Answers
I made a C program. And I made a go file with go functions defined. In the C program, I called go functions
You made a Go program which calls C functions (the other way around is not yet possible.) Then you're apparently calling Go functions from C again which is a bit weird and doesn't make much sense most of the time. See https://stackoverflow.com/a/6147097/532430.
I'm going to assume you used gccgo to compile your program. Because if you used Go's gc then there wouldn't be any confusion about what language your program is written in.
Is go called from C compiled or interpretted?
It's compiled. gccgo is a Go front-end for GCC. And GCC stands for GNU Compiler Collection.
In your program when you first call the go function,the compiler will generate the necessary codes for function call,space for function arguments,store details about function arguments type etc. If everything is correct as per the compiler standard,object file is created and further there are other processes like linking and all. So basically you cannot say it as " Is go called from C compiled or interpretted?",it's a series of processes which works together to make your program run.

- 302
- 1
- 12
-
"Any program in C goes through compilation process" -- Explain Ch, Cling and Cint. – autistic Apr 01 '15 at 07:01
-
2@undefinedbehaviour these are weird implementations of the C language and are not representative for the language. – fuz Apr 01 '15 at 14:41
-
@FUZxxl The statement is invalid because there are edgecases where it's not correct. Whether those edgecases are bizarre or not has no bearing on the validity of the statement. – autistic Apr 01 '15 at 14:54
-
@undefinedbehaviour The statement that Ch, Cling and Cint are not representative implementations of the C language? I don't see what's wrong with that statement. It's definitely weird to interpret C. – fuz Apr 01 '15 at 15:07
-
@FUZxxl No. The statement that "Any program in C goes through compilation process" is flawed, no matter how bizarre the edgecases are, they still render the quote invalid. This is what you're arguing about, right? Otherwise, you've hijacked my actual point with irrelevant garbage. – autistic Apr 01 '15 at 15:13