an example library for the Amiga
all data/bss belongs to the library structure -> no fuzz with a4.
simply run
m68k-amigaos-gcc -nostartfiles -o example.library alibrary.c myfx.c zinitexit.c -Os
note that alibrary.c should be specified as the first file.
Note that you define your library functions with register a6 in the library's code:
int myfunction1(int a asm("d0"), struct MyLib * mylib asm("a6"))
For the library users this becomes
int myfunction1(int a asm("d0"))
the register a6 is loaded while invoking the library function.
this example provides a library base which shares the data to all openers. if you need a variant which provides a library base per opener: #define MULTIBASE.