Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / devs / AHI / Drivers / Device / device-init.c
blobc3d2d4842a1e31f3ac554e89d875e2828ab5afd3
2 #include <config.h>
4 #include "library.h"
5 #include "DriverData.h"
7 #ifdef __AROS__
8 #include <proto/stdc.h>
10 struct StdCBase *StdCBase = NULL;
11 #endif
14 /******************************************************************************
15 ** Custom driver init *********************************************************
16 ******************************************************************************/
18 BOOL
19 DriverInit( struct DriverBase* AHIsubBase )
21 struct DeviceBase* DeviceBase = (struct DeviceBase*) AHIsubBase;
23 DOSBase = (struct DosLibrary*) OpenLibrary( "dos.library", 37 );
25 if( DOSBase == NULL )
27 Req( "Unable to open 'dos.library' version 37.\n" );
28 return FALSE;
31 #ifdef __AMIGAOS4__
32 if ((IDOS = (struct DOSIFace *) GetInterface((struct Library *) DOSBase, "main", 1, NULL)) == NULL)
34 Req("Couldn't open IDOS interface!\n");
35 return FALSE;
37 #endif
39 #ifdef __AROS__
40 StdCBase = (struct StdCBase *) OpenLibrary( "stdc.library", 0 );
42 if( StdCBase == NULL )
44 Req( "Unable to open 'stdc.library'.\n" );
45 return FALSE;
47 #endif
49 return TRUE;
53 /******************************************************************************
54 ** Custom driver clean-up *****************************************************
55 ******************************************************************************/
57 VOID
58 DriverCleanup( struct DriverBase* AHIsubBase )
60 struct DeviceBase* DeviceBase = (struct DeviceBase*) AHIsubBase;
62 #ifdef __AROS__
63 CloseLibrary( (struct Library*) StdCBase );
64 #endif
66 #ifdef __AMIGAOS4__
67 DropInterface( (struct Interface *) IDOS);
68 #endif
70 CloseLibrary( (struct Library*) DOSBase );