home *** CD-ROM | disk | FTP | other *** search
INI File | 1994-11-01 | 6.1 KB | 170 lines |
- [LANGUAGE english; PARENT keywords; PAGE 11-6]
- [C;6;B] AMIGALIBRARY or AL
- [7]Default: normal executable
- [J;1;N]
- NOTE: if this flag is set (or one of the LIBFD, LIBID, \
- LIBPREFIX, LIBREVISION or LIBVERSION instructions is used,) \
- lk supposes that you want to use the default 'library.o' \
- file. Any file which contains the '_LibraryBase' symbol \
- (XDEF) will replace the default lk object. lk will \
- link that file as the first object and it must be of \
- type code. If such symbol does not exist, lk will first \
- check for 'LK:LIB/library.o', if that file does not \
- exist, the internal one will be used instead. The \
- default lk header file does not handle Slink or DICE \
- required initialisations.
- Another solution is to use the DEFINE instruction \
- to forbid the usage of the default library with:
- DEFINE _LibraryBase=0
-
- This instruction supposes that you are creating an Amiga \
- library (like those present into your LIBS: path.) lk will \
- automatically generates the table list for the function \
- jumps from the corresponding file description ('.fd' file.) \
- The name of the '.fd' file will be defined with the LIBFD \
- instruction or from the destination file name. The name of \
- the library will be the destination file name.
- If you have to define private functions into the file \
- description, you should define them with the names \
- 'private1', 'private2', etc... and use the DEFINE \
- instruction to redirect them on your functions:
- DEFINE private1=<my function1 name>
- DEFINE private2=<my function2 name>
- ...
-
- If you need to receive the parameters on the stack \
- you will use LIBSTACKPARAM instruction. By default lk \
- supposes that your functions receive registers.
-
- The version and revision numbers of the library are \
- defined through the instructions LIBVERSION and LIBREVISION. \
- Those will also define the __LIBRARYVERSION and \
- __LIBRARYREVISION symbols respectivly. Both values \
- are used to define the library identification as well \
- than the library version used to bump an open.
-
- The string identification will be defined throught \
- one of the COPYRIGHT or LIBID instructions. Only the \
- copyright is required because the remained is always \
- generated by lk. If no copyright is defined, the default \
- identification string is still created by lk.
-
- If you use the default library header given with lk, \
- you must define the following functions, and the \
- variable '_LibraryBase' is available to you. This \
- global variable contains the pointer of your \
- library which does not need to be opened by again, \
- and can always be used in replacement to the variable \
- called 'mylib' given in any of the following functions. \
- To avoid the usual auto-init/exit open/close code, you \
- may add a definition when you link:
- DEFINE <lib base name>=_LibraryBase
- like for instance:
- DEFINE _BOSBase=_LibraryBase
- [INDENT 5]
- 1. 'LibInit' which contains all necessary initialisations \
- for your library. Its C proto-type is:
-
- [2] extern struct Library * _LibInit(
- [R] struct Library *mylib);
- [L;1]
- If you have nothing to create, just type:
- [2] long _LibInit(mylib)
- struct Library *struct;
- {
- return (mylib);
- }
- [J;1]
- This function must return the library pointer \
- (mylib) to accept the library installation, otherwise \
- return null (failed) and the complete library will be \
- freed by the system. This function should avoid calls \
- to other functions of the library.
- If your compiler support register definition you \
- may defines 'mylib' as register D0 (and A6 is SysBase.)
-
- 2. 'LibOpen' which contains the necessary initialisations \
- for each new open intented by user. The system will increment \
- the open counter by one when this routine does not fail. \
- Its C proto-type is:
-
- [2] extern struct Library * _LibOpen(
- [R] struct Library *mylib);
- [L;1]
- If you have nothing to allocate, just type:
- [2] long _LibOpen(mylib)
- struct Library *struct;
- {
- return (mylib);
- }
- [J;1]
- This function must return the library pointer if the \
- library has been opened with success.
- If your compiler supports register definitions you \
- may defines 'mylib' as register D0.
-
- 3. 'LibClose' which contains the necessary destructors. \
- The system will decrement the open counter by one. Its C proto-type \
- is:
-
- [2] extern BOOLEAN _LibClose(
- [R] struct Library *mylib);
- [L;1]
- If you have nothing to free, just type:
- [2] long _LibClose(mylib)
- struct Library *struct;
- {
- return (0);
- }
- [J;1]
- This function must return FALSE if the library does \
- not have to be expunged. Do not forget that you cannot \
- expunge your library until all users closes it (however \
- the expunge code check the counter.)
- If your compiler supports register definitions you \
- may defines 'mylib' as A6.
-
- 4. 'LibExpunge' which contains the necessary destructors \
- to free the library from memory. If this function is not \
- defined lk assume that no expunge is available and the \
- default LibExpunge will be used (it does nothing!) Its \
- C proto-type is:
-
- [2] extern long _LibExpunge(
- [R] struct Library *mylib);
- [L;1]
- If you have nothing to destroy, just type:
- [2] long _LibExpunge(mylib)
- struct Library *struct;
- {
- return (1);
- }
- [J;1]
- This function must return FALSE if the library cannot \
- be expunged. Otherwise it will return any non zero value \
- and the system expunge function will free the library \
- memories (base and segment list.) The system expunge \
- function automatically prevents the destruction while \
- some users still access the library.
- If your compiler supports register definitions you \
- may defines 'mylib' as A6.
- [INDENT]
- [5]
- IMPORTANT:
-
- In the LibInit() and LibExpunge() functions, you MUST \
- avoid the usage of the DOS filer system, otherwise the \
- Forbid()/Permit() of the system are lost and the system may \
- crash.
- [1]
- See also:
- [L;3][LINK copyright] COPYRIGHT
- [LINK fdlib] FDLIB
- [LINK libfd] LIBFD
- [LINK copyright] LIBID
- [LINK libprefix] LIBPREFIX
- [LINK version] LIBREVISION
- [LINK version] LIBVERSION
- [LINK version] VERSION
- [5; LINK about; GOTO address] Become Registred
-