Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!zaphod.mps.ohio-state.edu!wuarchive!uunet!cbmvax!ken From: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Newsgroups: comp.sys.amiga.programmer Subject: Re: Testing for 1.3 VS. 2.0 Message-ID: <19188@cbmvax.commodore.com> Date: 21 Feb 91 15:22:52 GMT References: <1991Feb20.234836.1@happy.colorado.edu> Reply-To: ken@cbmvax.commodore.com (Ken Farinsky - CATS) Organization: Commodore, West Chester, PA Lines: 32 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 , 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