The IDL_IDLBridge::SetVar function copies the value of a variable from the parent IDL process to the $MAIN$ level of the child process under the given name. IDL_IDLBridge::SetVar is subject to the following limitations:

  • Only scalar or array variables of numeric or string type can be transferred. Structures, pointers, and object references cannot be transferred between processes using the IDL_IDLBridge object.
  • IDL_IDLBridge::SetVar makes a copy of the data in the child process, which may affect the performance of your application if the amount of data involved is large. In such cases, the use of shared data files or shared memory (SHMMAP and SHMVAR) may offer a more efficient way to share data.

It is not possible to call GetVar or SetVar when a child process is actively executing a command (when IDL_IDLBridge::Status equals 1).

Note: This method is disabled in IDL Virtual Machine mode.


Obj->[IDL_IDLBridge::]SetVar, Name, Value



A string containing the name of the variable to be set in the child process.


A scalar or array variable of string or numeric type containing the data to be copied to the child process.




The following example accesses image data from a JPEG file and passes it to a child process using SetVar.

mriFile= FILEPATH('pdthorax124.jpg', $
   SUBDIRECTORY = ['examples', 'data'])
READ_JPEG, mriFile, mriImg
; Create an IDL_IDLBridge object. Pass the image data (mriImg) to
; the child process in a variable named "image." Display the 
; image data in a child process.
oBridge = OBJ_NEW("IDL_IDLBridge")
oBridge->SetVar, "image", mriImg
oBridge->Execute, "TVSCL, image"

Note: See Examples for additional examples.

Version History