mritter0 wrote:I just added application.library support to my program and had the same concern with libauto. Tested like Lyle suggested, still opening v1. I got a huge pop up error about it when ran my program.
I came up with a solution (hack) for libauto:
After verifying that the correct version of application.library openedThen close the library and re-open it with v2:Code: Select all
if (!ApplicationBase || !LIB_IS_AT_LEAST((struct Library *)ApplicationBase,53,1)) { // error message return(FALSE); }
Code: Select all
IExec->DropInterface((struct Interface *)IPrefsObjects);
IExec->DropInterface((struct Interface *)IApplication);
IExec->CloseLibrary(ApplicationBase);
if (!(ApplicationBase=IExec->OpenLibrary("application.library",53)))
{
// error message
return(FALSE);
}
IApplication=(struct ApplicationIFace *)IExec->GetInterface(ApplicationBase,"application",2,NULL);
IPrefsObjects=(struct PrefsObjectsIFace *)IExec->GetInterface(ApplicationBase,"prefsobjects",2,NULL);
[/code]
It appears libauto still closes the library.
Couple of things here, using your approach you only need to drop the ineterface and obtain the new one, not close the library, or you could even open the second interface as IApplication2 then close it yourself at the end, though that would cause issues if you were using __USE_INLINES__.
The correct thing todo however is to declare ApplicationBase and IApplication yourself in your code and then open and close them yourself.
The way libauto works is that it only loads in code to open libraries if you don't declare the bases yourself. ie
To us libauto;
Code: Select all
#include <proto/somelib.h>
/*
rest of program
*/
Code: Select all
#include <proto/somelib.h>
struct Library SomeLibbase;
struct SomLibIFace *ISomeLib;
BOOL OpenMyLibs()
{
}
/*
rest of program
*/