home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 390.lha / LibExample / README < prev    next >
Encoding:
Text File  |  1990-06-02  |  2.7 KB  |  85 lines

  1.  
  2.  
  3.     Note May 1990:  I'm just reposting this, these files are all very old
  4.     but still make for a relatively good example of library code.  I do not
  5.     even think they are compatible with Aztec anymore either !!!!!!!!
  6.  
  7.                     -Matt
  8.  
  9.  
  10.  
  11.     ****************************************************************
  12.  
  13.     Working Library Skeleton for AZTEC C.
  14.  
  15.     By Matthew Dillon
  16.  
  17.     Placed in Public Domain
  18.  
  19.  
  20.     This is an example library for Aztec C.  It will not work with
  21. Lattice C due to extensive Manxisms.   This library does not use the
  22. auto-init method and thus provides a contrast with the RKM example.  Note
  23. especially the compile time options required (in the Makefile).  Here are
  24. the reasons:
  25.  
  26.     +B    No reference to startup code.
  27.  
  28.     +CD    Large code and data model.  Alternately you can setup A4
  29.         on every entry point and use the small code and data model.
  30.  
  31.     +L    32 bit integers.  My preference.. not required when
  32.         designing your own libraries, of course.
  33.  
  34.     +p    compatibility option... Aztec automagically saves D2 and D3
  35.         on function calls.  Otherwise we would have to do it by hand
  36.         on every entry point.
  37.  
  38.  
  39. LINK LIBRARY:
  40.  
  41.     The routines in this example expect arguments on the stack.   You
  42.     will note the link library is incredibly simple ... the assembly
  43.     to make a library call is only two instructions.  Note that since the
  44.     arguments are expected on the stack, the link library routines cannot
  45.     save anything on the stack.  A0-A1 D0-D1 are scratch however and I
  46.     simply use A0.
  47.  
  48.     Thus this library is optimized for C->C calls.    You want your library
  49.     to follow the AMIGA STANDARD, which is that only A0-A1 D0-D1 may be
  50.     trashed.  The only register Aztec C calls will not automatically
  51.     save is A6 and this must be done WITHIN your actual library routines
  52.     (see testlib.c).
  53.  
  54. FILES:
  55.  
  56.     Makefile
  57.  
  58.         For making the library itself.    I make reference to a
  59.         precompiled symbol table which is all the AMIGA includes
  60.         (none of the Aztec includes) */*.h . That is, all the
  61.         include files in sub-directories but none of the
  62.         top-level include files.  You will have to either generate
  63.         such a symbol table yourself or simply figure out which
  64.         #include's you need to make.  If generating the symbol
  65.         table yourself, remember to use the +L option.
  66.  
  67.     hlib.asm
  68.  
  69.         Example 'link' library... what you need to link with your
  70.         C programs to be able to call library functions after openning
  71.         the library and sticking the library base into the proper
  72.         global variable.
  73.  
  74.     testlib.c
  75.  
  76.         The source to the library itself.
  77.  
  78.     test.c
  79.  
  80.         The source to the test program.  Must be linked with
  81.         hlib.o    .  Without arguments, the library is openned, the
  82.         routines executed, then closed.  With arguments,  the
  83.         program does an expunge (via allocating too much memory).
  84.  
  85.