home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / source / intuitlib.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-24  |  595 b   |  30 lines

  1. void __regargs __autoopenfail(char *);
  2.  
  3. #include <constructor.h>
  4. #include <proto/exec.h> 
  5. #include <proto/intuition.h>
  6. struct IntuitionBase *IntuitionBase ;
  7. static void *libbase;
  8. extern long __oslibversion;
  9.  
  10. CBMLIB_CONSTRUCTOR(openintuit)
  11. {
  12.    IntuitionBase = libbase = 
  13.        (void *)OpenLibrary("intuition.library", __oslibversion);
  14.    if (IntuitionBase == NULL)
  15.    {
  16.      __autoopenfail("intuition.library");
  17.      return 1;
  18.    }
  19.    return 0;
  20. }
  21.  
  22. CBMLIB_DESTRUCTOR(closeintuit)
  23. {
  24.    if (libbase)
  25.    {
  26.       CloseLibrary((struct Library *)libbase);
  27.       libbase = IntuitionBase = NULL;
  28.    }
  29. }
  30.