There's a distinction between initialisation and library open/close routines.
Your initialisation routine is called once when the library is loaded from disk. The first time some program OpenLibrary()s your library, Exec loads it from disk and executes your intialisation routine. That's where you would typically allocate memory for the library base, create your task etc. Then Exec calls your library open routine (offset -6 from library base).
If your initialisation routine returns failure, your library won't be added to the system list.
If your initialisation routine succeeded then the library will be added to the system list. Then your open routine would be called.
|