home *** CD-ROM | disk | FTP | other *** search
-
-
- Note May 1990: I'm just reposting this, these files are all very old
- but still make for a relatively good example of library code. I do not
- even think they are compatible with Aztec anymore either !!!!!!!!
-
- -Matt
-
-
-
- ****************************************************************
-
- Working Library Skeleton for AZTEC C.
-
- By Matthew Dillon
-
- Placed in Public Domain
-
-
- This is an example library for Aztec C. It will not work with
- Lattice C due to extensive Manxisms. This library does not use the
- auto-init method and thus provides a contrast with the RKM example. Note
- especially the compile time options required (in the Makefile). Here are
- the reasons:
-
- +B No reference to startup code.
-
- +CD Large code and data model. Alternately you can setup A4
- on every entry point and use the small code and data model.
-
- +L 32 bit integers. My preference.. not required when
- designing your own libraries, of course.
-
- +p compatibility option... Aztec automagically saves D2 and D3
- on function calls. Otherwise we would have to do it by hand
- on every entry point.
-
-
- LINK LIBRARY:
-
- The routines in this example expect arguments on the stack. You
- will note the link library is incredibly simple ... the assembly
- to make a library call is only two instructions. Note that since the
- arguments are expected on the stack, the link library routines cannot
- save anything on the stack. A0-A1 D0-D1 are scratch however and I
- simply use A0.
-
- Thus this library is optimized for C->C calls. You want your library
- to follow the AMIGA STANDARD, which is that only A0-A1 D0-D1 may be
- trashed. The only register Aztec C calls will not automatically
- save is A6 and this must be done WITHIN your actual library routines
- (see testlib.c).
-
- FILES:
-
- Makefile
-
- For making the library itself. I make reference to a
- precompiled symbol table which is all the AMIGA includes
- (none of the Aztec includes) */*.h . That is, all the
- include files in sub-directories but none of the
- top-level include files. You will have to either generate
- such a symbol table yourself or simply figure out which
- #include's you need to make. If generating the symbol
- table yourself, remember to use the +L option.
-
- hlib.asm
-
- Example 'link' library... what you need to link with your
- C programs to be able to call library functions after openning
- the library and sticking the library base into the proper
- global variable.
-
- testlib.c
-
- The source to the library itself.
-
- test.c
-
- The source to the test program. Must be linked with
- hlib.o . Without arguments, the library is openned, the
- routines executed, then closed. With arguments, the
- program does an expunge (via allocating too much memory).
-
-