I rather like this idea, the last time I checked the pre-processor output the windows guff made me feel a little ill.
I'd like to do this and removing the C runtime, I just had a quick bash at it but tripped up fairly quickly.
Here's my MiniWin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 | // Bloatless version of windows.h, just including the things from windows.h that I need
extern "C"
struct HINSTANCE__
{
int unused;
};
typedef struct HINSTANCE__* HINSTANCE;
typedef char* LPSTR;
#define WINAPI __stdcall
int WINAPI
WinMain (
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd
);
typedef const wchar_t* LPCWSTR;
typedef HINSTANCE HMODULE;
HMODULE WINAPI GetModuleHandle(LPCWSTR lpModuleName);
void __stdcall ExitProcess(unsigned int uExitCode);
|
Then when I try and build a simple (do nothing) program I get the following build errors:
| Main_win32.obj : error LNK2019: unresolved external symbol "struct HINSTANCE__ * __cdecl GetModuleHandle(wchar_t const *)" (?GetModuleHandle@@YAPEAUHINSTANCE__@@PEB_W@Z) referenced in function "void __cdecl WinMainCRTStartup(void)" (?WinMainCRTStartup@@YAXXZ)
Main_win32.obj : error LNK2019: unresolved external symbol "void __cdecl ExitProcess(unsigned int)" (?ExitProcess@@YAXI@Z) referenced in function "void __cdecl WinMainCRTStartup(void)" (?WinMainCRTStartup@@YAXXZ)
|
I'm guessing this is because the code signatures of the functions in my header don't match those in kernel32.lib
I suspect the problem is that I cut some corners grabbing code from windows.h as going into that is like going down the rabbit hole!
Any ideas? (is there a way of checking what the code signatures are in the lib?)
ta,
Passive