Hi everybody, currently I do all my AOS-coding in a (hopefully) AOS3.x compatible way. Thus I use OpenLibrary() and CloseLibrary() in order to make use of Lib-Functions for example from asl.library, graphics.library, intuition.library, gadtools.library, diskfont.library, layers.library and so on. I'm also always set __USE_INLINE__ as a Compiler flag (-D for GCC). I don't use IFaces or sth. else special in AOS4 at all. Now I heard that this is not really necessary since when using #define __USE_INLINE__ switch every amigaos function will be considered as old os3.x function, without special casting like IExec->function() or IIntuition->function(), what also means that all the stuff will open automatically, without needs of open the IFaces an so on. Usually together with that -lamiga and -lauto linking libs are added. This confuses me a little bit. I'm wondering whether it is necessry to call OpenLibrary() and CloseLibrary() in order to use Libfunctions or not when coding under AOS4 (even in old AOS3.x/68k style)? Maybe somebody here can shed some light on this? Many thanks in advance and Best Regards
Mon, 2013-03-25 01:53#1
Automatic opening and closing of Libraries?
#include <proto/protofile.h>to code). Also it is no harm to just open them all in code manually, and its even "preffered" to have it like this and do not use -lauto. But still, i for myself all the time use it, just because its easy. More of it, i pretty offten open half of libs manually, and half of libs via -lauto, and open some libs which will cover -lauto: thats suck and mess, but works.
Personally, I only use -lauto for testing or implementing an idea quickly. When my programming itch actually turns into a proper application, I always open/close resources manually.
- The -lauto switch only opens the most common libraries; you may have to open the rest manually (which somehow spoils the beauty of -lauto).
- Manual opening gives you better library version control.
- Manual opening allows you to implement meaningful, user-friendly error messages when the library fails to open. Whereas -lauto will just throw out some general message which the user may not find very helpful.