kskelm@happy.colorado.edu (02/21/91)
What is the simplest way for a program to automatically detect whether it is running under 1.3 or 2.0? Thanks, Kevin Kelm
peterk@cbmger.UUCP (Peter Kittel GERMANY) (02/21/91)
In article <1991Feb20.234836.1@happy.colorado.edu> kskelm@happy.colorado.edu writes: > > What is the simplest way for a program to automatically detect whether >it is running under 1.3 or 2.0? Just do an OpenLibrary("graphics.library",36). If it fails (==0) then you run pre-2.0. This library should be in Kickstart ROM on every Amiga model. (I hope also in future? Should one better choose exec or dos library?) -- Best regards, Dr. Peter Kittel // E-Mail to \\ Only my personal opinions... Commodore Frankfurt, Germany \X/ {uunet|pyramid|rutgers}!cbmvax!cbmger!peterk
ken@cbmvax.commodore.com (Ken Farinsky - CATS) (02/21/91)
In article <1991Feb20.234836.1@happy.colorado.edu> kskelm@happy.colorado.edu writes: > > What is the simplest way for a program to automatically detect whether >it is running under 1.3 or 2.0? Look at the library version number. See <exec/libraries.h>, the version is lib_Version. 1.2 is version 33, 1.3 == 34, 2.0 == 36 (except special cases in 2.0x which require 37). Do NOT test version numbers for equality, such as: /* NEVER DO THIS!!! ** (lib_Version test for equality is wrong) ** if you do this, your application will lose features ** when the version number is increased in the future. */ if (IntuitionBase->LibNode.lib_Version == 36) win = OpenWindowTagList(NULL,tags); else win = OpenWindow(&newwin); if (win == NULL) handle_error(); Instead, test for greater than or equal, as the features will not go away with later versions of the OS. if (IntuitionBase->LibNode.lib_Version >= 36) -- -- Ken Farinsky - CATS - (215) 431-9421 - Commodore Business Machines uucp: ken@cbmvax.commodore.com or ...{uunet,rutgers}!cbmvax!ken bix: kfarinsky
dillon@overload.Berkeley.CA.US (Matthew Dillon) (02/22/91)
In article <1991Feb20.234836.1@happy.colorado.edu> kskelm@happy.colorado.edu writes: > > What is the simplest way for a program to automatically detect whether >it is running under 1.3 or 2.0? > > Thanks, > > Kevin Kelm Check the version number in exec.library, like this: extern struct Library *SysBase; ... if (SysBase->lib_Version >= 36) { .. you are running under 2.0 .. } -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA
rwm@atronx.OCUnix.On.Ca (Russell McOrmond) (02/22/91)
In a message posted on 21 Feb 91 05:48:36 GMT, kskelm@happy.colorado.edu wrote: k> k> What is the simplest way for a program to automatically detect whether k>it is running under 1.3 or 2.0? if ((DOSBase->dl_lib.lib_Version) >= 36) { DoWild2.0Thingie; } else { DoIcky1.3Thingie; } --- Opinions expressed in this message are my Own. I represent nobody else. Russell McOrmond rwm@Atronx.OCUnix.On.Ca {tigris,alzabo,...}!atronx!rwm FidoNet 1:163/109 Net Support: (613) 230-2282 Amiga-Fidonet Support 1:1/109 Gateway for .Amiga.OCUnix.On.Ca