Andy Pack
5f04cacd81
Affected files: .obsidian/workspace.json Projects/Dev Options.md Projects/Mixonomer.md Projects/NoteCrawler.md Projects/Selector.md Projects/To Do App.md STEM/CS/ABI.md STEM/CS/Calling Conventions.md STEM/CS/Code Types.md STEM/CS/Compilers.md STEM/CS/ISA.md STEM/CS/Language Binding.md STEM/CS/Languages/Assembly.md STEM/CS/Languages/C++.md STEM/CS/Languages/Javascript.md STEM/CS/Languages/Python.md STEM/CS/Languages/Rust.md STEM/CS/Languages/dotNet.md STEM/IOT/OS/Composition.md
33 lines
1.3 KiB
Markdown
33 lines
1.3 KiB
Markdown
---
|
|
tags:
|
|
- low-level
|
|
- dev
|
|
---
|
|
- The order in which atomic (scalar) parameters, or individual parts of a complex parameter, are allocated
|
|
- How parameters are passed
|
|
- Pushed on the stack, placed in registers, or a mix of both
|
|
- Which registers the called function must preserve for the caller
|
|
- Also known as: callee-saved registers or non-volatile registers
|
|
- How the task of preparing the stack for, and restoring after, a function call is divided between the caller and the callee
|
|
|
|
Subtle differences between [Compilers](Compilers.md), can be difficult to interface codes from different [compilers](Compilers.md)
|
|
|
|
Calling conventions, type representations, and name mangling are all part of what is known as an [application binary interface](https://en.wikipedia.org/wiki/Application_binary_interface) ([ABI](ABI.md))
|
|
|
|
# cdecl
|
|
C declaration
|
|
|
|
- Originally from Microsoft's C [compiler](Compilers.md)
|
|
- Used by many C [compilers](Compilers.md) for x86
|
|
- Subroutine arguments passed on the stack
|
|
- Function arguments pushed right-to-left
|
|
- Last pushed first
|
|
- Caller cleans stack after function call returns
|
|
|
|
# stdcall
|
|
|
|
- Variation on Pascal calling convention
|
|
- Callee cleans stack
|
|
- Params pushed onto stack right-to-left
|
|
- Same as _cdecl_
|
|
- Standard for Microsoft Win32 API |