difference between WINAPI, APIENTRY, ... - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

difference between WINAPI, APIENTRY, ...

Hello,
Recently I have been looking at some beginner Windows Programming tutorials, and have found an incosistency among tutorials. What is the difference in defining WinMain in the following examples?

[code]int [b]WINAPI[/b] WinMain(...)
int [b]APIENTRY[/b] WinMain(...)
int [b]PASCAL[/b] WinMain(...)[/code]



-Tony

Comments

  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    They all do pretty much the same thing. I prefer to use WINAPI for my executables and use APIENTRY for the entry-point in DLLs. I don't do Pascal since it's bass-ackwards from every other language I know, and thus don't use PASCAL for entry-points. I would assume that using PASCAL would mean you're coding the WinMain() loop in Pascal, but I'm not sure.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • RaizoRaizo Posts: 131Member
    : They all do pretty much the same thing. I prefer to use WINAPI for my executables and use APIENTRY for the entry-point in DLLs. I don't do Pascal since it's bass-ackwards from every other language I know, and thus don't use PASCAL for entry-points. I would assume that using PASCAL would mean you're coding the WinMain() loop in Pascal, but I'm not sure.
    :
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]
    :
    :

    gotcha. Thanks!

    -Tony

  • chick80chick80 Posts: 349Member
    They're exactly the same thing. If you open windef.h you'll find:

    [code]
    #define CALLBACK __stdcall
    #define WINAPI __stdcall
    #define WINAPIV __cdecl
    #define APIENTRY WINAPI
    #define APIPRIVATE __stdcall
    #define PASCAL __stdcall
    [/code]

    So, all the three things mean __stdcall.
    In older compilers PASCAL was defined as __pascal, which as __fortran and __syscall is not longer supported by the new compilers (or at least by Visual Studio, don't know about other compilers).

    nICO

    [hr]
    [italic]How beautiful, if Sorrow had not made sorrow more beautiful than Beauty itself.[/italic]
    JOHN KEATS


Sign In or Register to comment.