source: trunk/src/odincrt/initterm.cpp@ 22010

Last change on this file since 22010 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 1.2 KB
Line 
1/*
2 * ODINCRT DLL entry point
3 *
4 * Copyright 1998 Sander van Leeuwen
5 * Copyright 1998 Peter Fitzsimmons
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 */
9
10#define INCL_DOSMODULEMGR
11#define INCL_DOSPROCESS
12#define INCL_DOSERRORS
13#include <os2wrap.h> // Odin32 OS/2 api wrappers
14#include <exitlist.h>
15#include <initdll.h>
16
17ULONG SYSTEM DLL_Init(ULONG hModule)
18{
19#ifdef WITH_KLIB
20 /*
21 * We need to reserve memory for the executable image
22 * before initiating any heaps. Lets do reserve 32MBs
23 */
24 PVOID pvReserved = NULL;
25 DosAllocMem(&pvReserved, 32*1024*1024, PAG_READ);
26#endif
27
28 if (DLL_InitDefault(hModule) == -1)
29 return -1;
30
31#if 1
32 /*
33 * Experimental console hack. Sets apptype to PM anyhow.
34 * First Dll to be initiated should now allways be OdinCrt!
35 * So include odincrt first!
36 */
37 PPIB pPIB;
38 PTIB pTIB;
39 APIRET rc = DosGetInfoBlocks(&pTIB, &pPIB);
40 if (rc != NO_ERROR)
41 return -1;
42 pPIB->pib_ultype = 3;
43#endif
44
45#ifdef WITH_KLIB
46 /* cleanup - hacking is done */
47 DosFreeMem(pvReserved);
48#endif
49
50 return EXITLIST_ODINCRT;
51}
52
53void SYSTEM DLL_Term(ULONG hModule)
54{
55 DLL_TermDefault(hModule);
56}
57
Note: See TracBrowser for help on using the repository browser.