X
3370

Using CALL_EXTERNAL with the Cygwin environment

Some Windows developers choose to use the Cygwin GCC port as their compiler. This TechTip describes how to set up IDL so that CALL_EXTERNAL works with GCC.

Several customers have reported success using CALL_EXTERNAL with Cygwin's GCC Windows port instead of Microsoft Visual Studio.

  • Create a new user environment variable (Control Panel -> System -> Advanced -> Environment Variables) called IDL_DLM_PATH.

    Set this to: C:\RSI\IDL61\bin\bin.x86;c:\cygwin\bin

  • Set the following parameters on !MAKE_DLL:
    1. !make_dll.LD = 'c:\cygwin\bin\ld.exe -shared -o %L %O %X'
    2. !make_dll.CC = 'c:\cygwin\bin\gcc.exe %X -fPIC -I"/cygdrive/c/RSI/IDL61/external/include" -c -D_REENTRANT %C -o %O'
    3. !make_dll.COMPILER_NAME='GCC'
  • To test, load and compile the STRING_ARRAY.PRO example in the IDL61\external\call_external\C subdirectory.

    IDL> string_array, 'Hello, Cygwin!', /VERBOSE

    Calling string_array with:

    STRARR_L STRING = 'Hello, Cygwin!'

    Hello, Cygwin!

    Result from string_array is:

    RESULT STRING = 'Hello, Cygwin!'

If the PATH environment does not also include c:\cygwin\bin, users may receive an error message that cygwin1.dll could not be found.