WARNING: Attempt to call undefined function: 'REVERSE' (when running an IDL SAV file)


When you execute an IDL SAV file application, you get a warning about precisely the REVERSE function being undefined:

Warning: Attempt to call undefined function: 'REVERSE'


With the release of IDL 8.8.1, the REVERSE function was ported from PRO code to internal C code to improve performance. Thus, if you create a SAV file application in IDL versions 8.8.1+ which uses REVERSE, that SAV file application will fail when run via prior IDL versions. 

Basically the issue is that when you make the SAV file in IDL 8.8.1, REVERSE is a system function built into the idl.dll and REVERSE.pro does not exist in the lib folder of IDL 8.8.1 installation. Thus it doesn't get compiled into the SAV file application. However, when the SAV file is then run in prior IDL versions, REVERSE is not part of idl.dll where it expects and it actually is only in PRO code which isn't usable in SAV files. In summary, 8.8.1 SAV files that make use of the REVERSE function are not backwards compatible to be used in older versions.


1) The best practice for IDL application development is to build your SAV file in the oldest version of IDL you will be running the application with (i.e. do not run the SAV file in an older version than it was built). In the case of this specific REVERSE problem, make sure to run the SAV file application in at least IDL version 8.8.1. 

2) Alternatively, if you absolutely must run the application in an older IDL version, you can copy REVERSE.pro from an older version of IDL into the IDL 8.8.1 lib folder. Then when you are building the SAV file, do an explicit .compile on REVERSE so it is included. This process may spawn some ignorable duplicate routine warnings:

•    .COMPILE YourRoutine
•    .COMPILE reverse.pro
•    SAVE, /routines, filename = ‘…sav’


Created by BC-NA (4/4/22), Reviewed by JU (4/5/22)

Please login or register to post comments.