home *** CD-ROM | disk | FTP | other *** search
-
- /* * * * * * * * * * * * * * * * * * * * * * * *
- * *
- * HOW TO BUILD YOUR OWN DISK-RESIDENT SHARED LIBRARY *
- * - WORKING EXAMPLE - *
- * *
- * by Jean-Michel FORGEAS *
- * February 1988 *
- * *
- * * * * * * * * * * * * * * * * * * * * * * * */
-
-
- Here is a WORKING example for LATTICE(TM) C compiler of how to CREATE
- and to use your own disk-resident libraries (such as translator.library,
- icon.library, diskfont.library etc.. supplied by Commodore
- in LIBS: directory on the Workbench disk).
-
-
- ----------------
-
- These files were compiled with Lattice C 4.0 and assembled with
- MCC Macro Assembler.
-
- ----------------
-
-
-
- HOW TO BUILD A LIBRARY OF C FUNCTIONS SHARED BY SEVERAL PROGRAMS AND
- MANAGED BY AMIGADOS AND EXEC ?
-
-
- 1) take the following files in RKM vol2, Appendix K:
-
- - asmsupp.i (Commodore support) -> execlib/i_asmsupp.i
- - mylib.i (skeleton declar. ) -> execlib/i_flamlib.i
- - mylib.asm (skeleton library ) -> execlib/libskel.asm
-
-
- 2) declare your new functions in:
-
- - i_flamlib.i
- - libskel.asm
- - libfuncs.c (your C functions must be written in reentrant manner)
-
-
- 3) under the CLI do:
-
- assign LIB: <directory where amiga.lib and AStartup.obj are>
- assign I: <directory of C includes>
- cd execlib
-
- assem libskel.asm -i <dir of .i> -o libskel.obj
- (--> libskel.obj 716 bytes on disk)
-
- lc1 -iI: -b0 -ccs libfuncs
- lc2 -r -v -s libfuncs
- (--> libfuncs.o 144 bytes on disk)
-
- execute ex_makelib
- (--> flam.library 516 bytes on disk)
-
- and that's it. The library should be now in LIBS: directory.
-
-
- -------------------
-
-
- HOW TO USE THIS LIBRARY WITH YOUR C PROGRAMS ?
-
- 1) create a test program that opens, uses and closes the library.
-
- - test.c
-
- NOTE: if you want the library to stay in memory after
- your program exit(), just suppress the call to RemLibrary().
-
- 2) create a .lib such as amiga.lib to link your programs with:
-
- - flam.lib.asm
-
-
- 3) under the CLI:
-
- lc1 -iI: -b0 -ccs test
- lc2 -r -v -s test
- (--> test.o 632 bytes on disk)
-
- assem flam.lib.asm -i <dir of .i> -o flam.lib
- (--> flam.lib 136 bytes on disk)
-
- blink LIB:AStartup.obj test.o TO test LIB flam.lib LIB:amiga.lib
- (--> test 2220 bytes on disk)
-
-
- -------------------
-
-
- NOTE:
- In this example, DOSBase and SysBase are not declared in libskel.asm,
- so if you want to call DOS or Exec functions - add
- the definitions _DOSBase and _SysBase in libskel.asm :
-
- _DOSBase DS.L 1
- _SysBase DS.L 1
-
- Don't forget to declare them in XDEF and to initialize them -
- look on initRoutine in libskel.asm.
-
-
- Enjoy !
-
-
- -------------------
- ___ _
- /__ / /_| /|/|
- / /__ / | / |
-
-
-
- CONTACT:
- -------
- J-M.Forgeas,
- 21 rue Voltaire,
- 92300 Levallois-Perret,
- FRANCE
-
-
-