in gcc compiler you can compile multiple C objects together using ld dose this c...

Tyler Roberts Answered 4 answers
Question by Tyler Roberts 1 year ago

Question

in gcc compiler you can compile multiple C objects together using ld dose this compiler allow that or is it just a single .c to .bin?

Answers

Answered by Daniel McCarthy

Instructor

Hello Tyler, yes we compile only to assembly language in the course. We do not create an assembler, just a compiler that takes C and produces assembly. Therefore its very possible for it to be assembled and linked with multiple objects.

Follow-up by Tyler Roberts

Question author

i mean can the C compiler take 2 different .c files and compile them together into a single nasm. or are you saying that the linking of diffrent C files happents at the nsam level?

Answered by Sameera Khatoon

Student

Hello Tyler, here is the link to c program compilation guide. I hope this helps you.
https://drive.google.com/file/d/1WkBcYB991AbNYgpU4FybIK0-djgigNVW/view?usp=sharing

Answered by Daniel McCarthy

Instructor

Hello Tyler, sorry for the late reply Its easier to email me direct if you have follow up questions as the Dragon Zap question interface needs a bit of a revamp. My email is daniel@dragonzap.com Our C compilers job is to compile source code into assembly code, that gets passed through NASM which produces a object file, then with a linker we can link the objects together to create a single executable file. This is how all compilers work even GCC, though GCC has a linker built within it. When working with C we produce objects and link them later on. Email me if you want a detailed explanation as I can answer any questions you have in detail

Thanks,
Dan