pragma(startaddress) and pragma(mangle)
This lesson provides an introduction to pragma(startaddress) and pragma(mangle).
We'll cover the following
pragma(startaddress)
pragma(startaddress)
specifies the start address of the program. Since the start address is normally assigned by the D runtime environment, it is very unlikely that you will ever use this pragma.
pragma(mangle)
pragma(mangle)
specifies that a symbol should be name mangled differently from the default name mangling method. Name mangling refers to how the linker identifies functions and their callers. This pragma is useful when D code needs to call a library function that happens to be a D keyword.
For example, if a C library had a function named override because override
happens to be a keyword in D, the only way of calling it from D would be through a different name. However, that different name must still be mangled as the actual function name in the library for the linker to be able to identify it:
Get hands-on with 1400+ tech skills courses.