Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.


Harris Geospatial / Docs Center / Using IDL / Example: Hello World

IDL

Example: Hello World

Example: Hello World

Our version of this now-famous program is a system function that returns a scalar containing the text “Hello World!”:

#include <stdio.h>
#include "idl_export.h"
IDL_VPTR hello_world(int argc, IDL_VPTR argv[])
{
return(IDL_StrToSTRING("Hello World!"));
}

This is about as simple as an IDL system routine can be. The function IDL_StrToSTRING(), returns a temporary variable which contains a scalar string. Since this is exactly what is wanted, hello_world() simply returns the variable.

After compiling this function into a sharable object (named, for example, hello_exe), we can link it into IDL with the following LINKIMAGE call:

LINKIMAGE, 'HELLO_WORLD', 'hello_exe', 1, 'hello_world', $ 
MAX_ARGS=0, MIN_ARGS=0

Now we can issue the IDL command:

PRINT, HELLO_WORLD()

IDL displays:

Hello World!



© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us