home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 377b.lha / libraries / samplelibrary / test / clibtest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1980-02-03  |  2.6 KB  |  77 lines

  1. ;/* clibtest.c - Execute me to compile me with Lattice 5.04
  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 #pragmas in sample.h
  6. */
  7.  
  8. /*
  9.  *  clibtest.c -- C example that calls the Sample.library functions
  10.  *
  11.  * Copyright (c) 1990 Commodore-Amiga, Inc.
  12.  *
  13.  * This example is provided in electronic form by Commodore-Amiga, Inc. for
  14.  * use with the 1.3 revisions of the Addison-Wesley Amiga reference manuals. 
  15.  * The 1.3 Addison-Wesley Amiga Reference Manual series contains additional
  16.  * information on the correct usage of the techniques and operating system
  17.  * functions presented in this example.  The source and executable code of
  18.  * this example may only be distributed in free electronic form, via bulletin
  19.  * board or as part of a fully non-commercial and freely redistributable
  20.  * diskette.  Both the source and executable code (including comments) must
  21.  * be included, without modification, in any copy.  This example may not be
  22.  * published in printed form or distributed with any commercial product.
  23.  * However, the programming techniques and support routines set forth in
  24.  * this example may be used in the development of original executable
  25.  * software products for Commodore Amiga computers.
  26.  * All other rights reserved.
  27.  * This example is provided "as-is" and is subject to change; no warranties
  28.  * are made.  All use is at your own risk.  No liability or responsibility
  29.  * is assumed.
  30.  */
  31.  
  32. #include <exec/types.h>
  33. #include <exec/libraries.h>
  34. #include <libraries/dos.h>
  35. #ifdef LATTICE
  36. #include <proto/all.h>
  37. #include <stdlib.h>
  38. #include <stdio.h>
  39. #include <string.h>
  40. int CXBRK(void) { return(0); }        /* Disable Lattice CTRL/C handling */
  41. int chkabort(void) { return(0); }    /* really */
  42. #endif
  43.  
  44. #include "samplebase.h"
  45. #include "sample.h"
  46.  
  47. void main(int,char**);
  48. struct SampleBase *SampleBase;
  49.  
  50. void main(int argc, char **argv)
  51.    {
  52.    LONG n;
  53.    struct Library *slib;
  54.  
  55.    /* Open sample.library */
  56.    if(!(SampleBase=(struct SampleBase *)OpenLibrary("sample.library",0)))
  57.       {
  58.       printf("Can't open sample.library\n");
  59.       exit(RETURN_FAIL);
  60.       }
  61.  
  62.    /* Print library name, version, revision */
  63.    slib = &SampleBase->LibNode;
  64.    printf("%s   Version %ld   Revision %ld\n",
  65.              slib->lib_Node.ln_Name, slib->lib_Version, slib->lib_Revision);
  66.  
  67.    /* Call the two functions */
  68.    n = Double(-7);
  69.    printf("Function Double(-7) returned %ld\n", n);
  70.  
  71.    n = AddThese(21,4);
  72.    printf("Function AddThese(21,4) returned %ld\n", n);
  73.  
  74.    CloseLibrary((struct Library *)SampleBase);
  75.    exit(RETURN_OK);
  76.    }
  77.