libnix4.library a result of the Simple Library Creation for the Amiga

Recently I wrote about simple library creation for the Amiga. Now I applied this to the libnix library and created the libnix4.library.
And there it is. If you build amiga-gcc then you'll find the libnix4.library in $PREFIX/m68k-amigaos/libnix. Copy it to your LIBS: folder and you are ready to use it.

Using the libnix4.library

Consider a very simple program tha outputs some float numbers:
#include <stdio.h>

int main() {
  for (int i = 1; i < 10; ++i) {
    printf("1/%ld=%f\n", i, 1. / i);
  }
  return 0;
}
Then you have to compile it adding -lm to make floating point stuff work:
m68k-amigaos-gcc -Os -noixemul float-test.c -o float-test -lm
And you get an executable with a size around 13k.
Now you can switch to using the library, just use a different -mcrt. The switch -noixemul is the same as -mcrt=nix20. Replace this to use the library:
m68k-amigaos-gcc -Os -mcrt=library float-test.c -o float-test
And you get an executable with a size around 3k.
Well, you have to install the libnix4.library which is 180k. But the more programs are using it, it's maybe worth it.

Other benefits

- The locale is automatically used. - You can easily create libraries that depend on libraries: Consider multiple libraries which are all make use of libnix4.library, then all refer to the same owned instance, the pointer struct Library * will be the same per task/process.

Drawbacks

- You can't use it with threaded programs. - You can't use it for resident programs.