LADSoft / OrangeC

OrangeC Compiler And Tool Chain
http://ladsoft.tripod.com/orange_c_compiler.html
Other
284 stars 39 forks source link

Error: Undefined External 'WinMain' in module c0pe.nas #971

Open ghost opened 8 months ago

ghost commented 8 months ago

Very simple program:

#include <windows.h>

int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               PWSTR szCmdLine, int CmdShow) {

    MessageBoxW(NULL, szCmdLine, L"Title", MB_OK);

    return 0;
}

Tried with both occ /Wg and gccocc -mwindows.

LADSoft commented 8 months ago

hm i'll have to work on this do we need a wmain() too?

ghost commented 8 months ago

Change the code to this and it will compile:

#include <windows.h>

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
               LPSTR szCmdLine, int CmdShow) {

    MessageBoxW(NULL, szCmdLine, L"Title", MB_OK);

    return 0;
}
GitMensch commented 5 months ago

According to https://learn.microsoft.com/windows/win32/learnwin32/winmain--the-application-entry-point the only thing to add is looking for either of both, preferably wWinain - not sure how to achieve this, though.

LADSoft commented 5 months ago

we don't quite do linking the same way as microsoft... so... without a rewrite this isn't likely to happen without additional compiler switches. I may consider a rewrite later, not right now though....