Functions

The Hello World IL example encompasses only one method. If only all software development requirements were that simple! Because IL is a stack based language, function parameters are pushed onto the stack and the function is called. The called function is responsible for removing any parameters from the stack and for pushing any return value back onto the stack for the caller of the function.

The process of pushing and popping values to and from the call stack can be visualized as shown in Figure 1.3.3.

Figure 1.3.3. The call stack.

Although Figure 1.3.3. depicts a very simplified view of the actual process, enough information is provide ...

Get C# and the .NET Framework: The C++ Perspective 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.