Search code examples
windowswinapid

Why are Windows functions in D extern?


Inside the WinAPI example for D, I noticed a lot of it's functions are 'tagged' as extern. Why is this? The functions clearly aren't extern.


Solution

  • The extern keyword specifies the linkage. WinMain must have external linkage so that it can be accessed from outside the module. It also specifies (in parentheses) the calling convention to use when calling a method. This is called the LinkageType. Detailed information can be found at Interfacing to C - D Programming Language.