Which Operating System is Running?

In some cases, in order to effectively take platform differences into account, your application will need to execute different code segments on different systems. Operating system and IDL version information is contained in the IDL system variable !VERSION. For example, you could use an IDL CASE statement that looks something like the following to execute code that pertains to a particular operating system family:

CASE !VERSION.OS_FAMILY OF 
   'unix'      : Code for Unix 
   'Windows'   : Code for Windows 
ENDCASE 

Writing conditional IDL code based on platform information should be a last resort, used only if you cannot accomplish the same task in a platform-independent manner.

Operating System Access

While IDL provides ways to interact with each operating system under which it runs, it is not generally useful to use operating-system native functions in a cross-platform IDL program. If you find that you must use operating-system native features, be sure to determine the current operating system (as described above) and branch your code accordingly.