Re: Can a script tell if it is running in the VM? [message #43532] |
Fri, 15 April 2005 12:00  |
tam
Messages: 48 Registered: February 2000
|
Member |
|
|
Wayne Landsman wrote:
>>
>> Is there some easy, and safe for IDL 5.x, way to check if
>> one is in the VM environment? It seems like there should
>> be a system variable that indicates the environment
>> but I didn't see it mentioned in the doucmentation I've seen.
>
>
> You can use the lmgr() function, e.g. lmgr(/VM) returns 1 if the current
> session is using a VM license, and there are many other options.
>
> I am a little confused about the reference to IDL 5.x though, since I
> thought the VM wasn't introduced until V6.0. (So if you are running
> V5.x then you know it is not a VM license...) --Wayne
>
Thanks,
This code will be
run by users in older versions of IDL and also by users
who are using the VM, so I need to be careful that I won't
get compilation/run errors in the older version. That's
caused problems in the past when trying to make a new capability
conditionally available.
So the safe construct is:
if !version.release ge '6' then begin
if (lmgr(/vm) eq 1) then begin
print, "In the VM"
endif
endif
but
if !version.release ge '6' and lmgr(/vm) then begin
... will fail
Now that you point this out, I can see this kind of guard being
using in mrd_struct.
Regards,
Tom
|
|
|