home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / saslib.lzh / squareme.c < prev    next >
C/C++ Source or Header  |  1992-02-02  |  1KB  |  87 lines

  1. /*
  2.  *    Demo library implementation: squareme.c
  3.  */
  4.  
  5. #include <exec/types.h>
  6.  
  7. /*
  8.  * The following variables should be declared in ONE of your C
  9.  * files.
  10.  */
  11.  
  12. struct Library *LibBase;
  13. struct ExecBase *SysBase;
  14. struct DosLibrary *DOSBase;
  15.  
  16. /*
  17.  * If you call functions in your own library, you need to declare your
  18.  * base as well.
  19.  */
  20. struct Library *DemoBase;
  21.  
  22. struct Library *__saveds LibInit(void)
  23. {
  24.  
  25.     /*
  26.      * This function is used to perform library-specific initialization.
  27.      * For a library that uses semaphores, this function could set them
  28.      * up.  This function must return the library base, or NULL if
  29.      * something went wrong.
  30.      */
  31.     
  32.     /*
  33.      * If you call yourself, then you must "open" yourself by doing
  34.      * the following:
  35.      */
  36.     DemoBase = LibBase;
  37.     
  38.     
  39.     return LibBase;
  40. }
  41.  
  42.  
  43. struct Library *__saveds LibOpen(void)
  44. {
  45.  
  46.     /*
  47.      * This function does process-specific library initialization
  48.      * for opens.  You must at least return the base.
  49.      */
  50.  
  51.     return LibBase;
  52. }
  53.  
  54.  
  55. void __saveds LibClose(void)
  56. {
  57.  
  58.     /*
  59.      * This function is called each time your library is closed.  Use
  60.      * it for things like syncing disks or freeing process-specific
  61.      * data.  Note: don't sync disks directly - signal another process
  62.      * instead.
  63.      */
  64.     
  65.     return;
  66. }
  67.  
  68.  
  69. BOOL __saveds LibExpunge(void)
  70. {
  71.  
  72.     /*
  73.      * This function frees all resources when your library is expunged.
  74.      */
  75.  
  76.     return TRUE;
  77. }
  78.  
  79.  
  80. int __saveds __asm LIBSquareMe(register __d0 int num)
  81. {
  82.  
  83.     return num * num;
  84. }
  85.  
  86.  
  87.