home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / TRSICAT.LZX / CATS_CD2_TRSI / Reference_Library / lib_examples / clibtest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-21  |  1.4 KB  |  52 lines

  1. ;/* clibtest.c--Calls the Sample.library functions (execute to compile with Lattice 5.10a)
  2. LC -b1 -cfistq -v -y -j73 clibtest.c
  3. Blink FROM LIB:c.o,clibtest.o TO clibtest LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. ; note - you must also link with sample.lib if not using sample_pragmas.h
  6. */
  7.  
  8. #include <exec/types.h>
  9. #include <exec/libraries.h>
  10. #include <libraries/dos.h>
  11.  
  12. #include <clib/exec_protos.h>
  13.  
  14. #include <stdlib.h>
  15. #include <stdio.h>
  16.  
  17. #include "sampleinclude/samplebase.h"
  18. #include "sampleinclude/sample_protos.h"
  19. #include "sampleinclude/sample_pragmas.h"
  20.  
  21. #ifdef LATTICE
  22. int CXBRK(void)     { return(0); }      /* Disable Lattice CTRL/C handling */
  23. void chkabort(void) { return; }         /* really */
  24. #endif
  25.  
  26. struct Library *SampleBase = NULL;
  27.  
  28. void main(int argc, char **argv)
  29.    {
  30.    LONG n;
  31.  
  32.    /* Open sample.library */
  33.    if(!(SampleBase=OpenLibrary("sample.library",0)))
  34.       {
  35.       printf("Can't open sample.library\n");
  36.       exit(RETURN_FAIL);
  37.       }
  38.    /* Print library name, ID string, version, revision */
  39.    printf("%s  Version=%ld   Revision=%ld  IdString: %s\n",
  40.              SampleBase->lib_Node.ln_Name, SampleBase->lib_Version,
  41.              SampleBase->lib_Revision, SampleBase->lib_IdString);
  42.  
  43.    /* Call the two functions */
  44.    n = Double(-7);
  45.    printf("Function Double(-7) returned %ld\n", n);
  46.    n = AddThese(21,4);
  47.    printf("Function AddThese(21,4) returned %ld\n", n);
  48.  
  49.    CloseLibrary(SampleBase);
  50.    exit(RETURN_OK);
  51.    }
  52.