IDL 7.1 adds a couple features that make distributing code to others easier:

  1. easily create a plugin update site which can install and update software just by typing in the URL of the site
  2. create shared object files with platform-specific names that are looked for when a DLM is loaded (this allows a cross-platform application to easily provide a DLM with builds for each of the platforms it supports)

I’ll discuss both of these features and distribute some code using them in this article. You must have IDL 7.1 in order to get the example code in this manner.

A plugin update site is a directory on a webserver containing code packaged up in a special way along with some files describing the code. To create the files, simply right-click on a project in the Project Explorer view of the Workbench and select “Create Plugin Update Site…”. Fill in the fields of the wizard to create the files for the update site and then upload them to some webserver. Previous problems I have experienced with updating from an update site seem to be fixed in IDL 7.1, so I will be distributing more code in this manner.

The second feature is basically a naming convention for shared object files that incorporates a platform-specific name. To create a shared object file with a platform-specific name, just set the PLATFORM_EXTENSION keyword of MAKE_DLL. If not using MAKE_DLL, just name the shared object according the naming conventions listed in the online help for DLMs (you can get there from the help for the PLATFORM_EXTENSION keyword of MAKE_DLL). Now do this on all the platforms you want to distribute to and the results can all be placed in a single directory without any name clashes. (Of course, the difficulty is having access to the necessary platforms.) Now when IDL loads that DLM, it will search based on the naming convention for the correct shared object file for the platform.

As an example of distributing code this way, below are the steps to install my dist_tools package (docs), a collection of routines and classes useful for writing applications intended to be distributed to others:

  1. Navigate the menu system: Help > Software Updates > Find and Install…
  2. Select “Search for new features to install”
  3. Select “New Remote Site” from the list of buttons on the right
  4. Use “Name: dist_tools” and “URL: http://updates.idldev.com/dist_tools”

After this process, you should have access to a DLM and .pro code from the package. Note: I have only compiled the DLM for 32-bit Windows, 32- and 64-bit Linux, and 64-bit Mac-Intel, so the DLM is only accessible on those platforms. After installing, you should be able to do:

IDL> print, mg_hostname()
% Loaded DLM: DIST_TOOLS.
starling.local
IDL> print, mg_idlversion(require='7.1')
% Compiled module: STRSPLIT.
% Compiled module: MG_CMP_VERSION.
1

For more information about what is in the dist_tools package, see the documentation.