Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / miami_autoinit.c
blobfc1b66bf070a800e5daf80b7cd0840c8b4d17f45
1 #include <intuition/intuition.h>
2 #include <proto/exec.h>
3 #include <proto/intuition.h>
4 #include "conf.h"
6 /* SAS C 6.50 kludge */
7 #ifdef SASC
8 #if __VERSION__ > 6 || __REVISION__ >= 50
9 #define exit(x) return x
10 #endif
11 #endif
13 /* AROS kludge, see below */
14 #ifdef __AROS__
16 #include <aros/symbolsets.h>
18 #undef CONSTRUCTOR
19 #define CONSTRUCTOR
20 #define exit(x) return x
21 #endif
23 extern STRPTR _ProgramName;
24 struct Library *MiamiBase = NULL;
26 LONG STDARGS CONSTRUCTOR _STI_200_openMiami(void)
28 struct Library *IntuitionBase;
30 MiamiBase = OpenLibrary("miami.library", 0);
31 if (MiamiBase)
32 return 0;
34 IntuitionBase = OpenLibrary("intuition.library", 36);
35 if (IntuitionBase) {
36 struct EasyStruct libraryES;
38 libraryES.es_StructSize = sizeof(libraryES);
39 libraryES.es_Flags = 0;
40 libraryES.es_Title = _ProgramName;
41 libraryES.es_TextFormat = "Unable to open miami.library";
42 libraryES.es_GadgetFormat = "Exit %s";
44 EasyRequestArgs(NULL, &libraryES, NULL, (APTR)&_ProgramName);
46 CloseLibrary(IntuitionBase);
48 exit(20);
51 void STDARGS DESTRUCTOR _STD_200_closeMiami(void)
53 if (MiamiBase) {
54 CloseLibrary(MiamiBase);
55 MiamiBase = NULL;
59 #ifdef __AROS__
62 * Unfortunately AROS startup code does not support early exit().
63 * This can be considered a serious C++ compatibility problem since
64 * constructors of static objects may throw exceptions,
65 * involving exit() or abort() calls.
68 static ULONG AROS_openMiami(void)
70 return _STI_200_openMiami() ? FALSE : TRUE;
73 ADD2INIT(AROS_openMiami, 10);
74 ADD2EXIT(_STD_200_closeMiami, 10);
76 #endif