CHAPTER 12Heading Out to C: Calling External Functions Written in the C Language

There's a lot of value in learning assembly language, most of it stemming from the requirement that you must know in detail how everything works or you won't get very far. From the very dawn of digital electronic computing, this has always been true, but from it follows a fair question: Do I really have to know all that?

The fair answer is no. It's possible to write extremely effective programs without having an assembly-level grip on the underlying machine and the operating system. This is what higher-level languages were created to allow: easier, faster programming at a higher level of abstraction. It's unclear how much of today's software would exist at all if it all had to be written in assembly language.

That includes Linux. There are some small portions of Linux written in assembly, but overall, the bulk of the operating system is written in C. (These days, post-2022, parts of Linux are starting to be written in a much newer and more memory-secure programming language called Rust.) The Linux universe revolves around the C language, and if you expect to make significant use of assembly language under Linux, you had better be prepared to learn some C and use it when you must.

There is almost immediate payoff: being able to access libraries of procedures written in C. There are thousands of such libraries, and those associated with the Linux operating system are mostly free and come with C source ...

Get x64 Assembly Language Step-by-Step, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.