Hacker News new | ask | show | jobs
by magicalhippo 792 days ago
Delphi, and I'm sure others, have had[1] this for ages:

When you declare a procedure or function, you can specify a calling convention using one of the directives register, pascal, cdecl, stdcall, safecall, and winapi.

As in your example, cdecl is for calling C code, while stdcall/winapi on Windows for calling Windows APIs.

[1]: https://docwiki.embarcadero.com/RADStudio/Sydney/en/Procedur...

2 comments

Since the Turbo Pascal days actually.
I was pretty sure it had it, I just couldn't find an online reference.
Turbo Pascal for Windows v1.5, on Windows 3.1, the transition step before Delphi came to be.
Ah, yeah that makes sense. Thanks!
C for example does this, albeit in compiler extensions, and with a longer tag than #.