From the course: Advanced C Programming: Integrating C and Assembly Language

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Solution: Linking modules

Solution: Linking modules

- [Instructor] Here is my solution for the main module. The external functions are all used. So each is declared here at lines two through five. The data section lists the prompts, two of which use address size calculation, the remainder use a null terminated string. Size sets the buffer sizes. In the BSS section two buffers are declared, name and mood. The first prompt is output calling the print string function at line 30. The prompt and its length are passed in registers, RDI and RSI. Next comes input set up properly and then called then comes the reply the greetings, reply string output, name output and new line output and the rest. All of which is assembled here using way too much code, but again that's assembly. Each module must be assembled one at a time. Order isn't important here. Main output, input. Upon success this process generates three object code files. The object codes are linked. LD is the name…

Contents