The choice of which code to use depends on the context in which the message is issued, but IDL_M_NAMED_GENERIC is usually preferred.
Note: For any significant development involving an IDL system routine, we recommend your code be packaged as a Dynamically Loadable Module (DLM), and that your DLM define a message block to contain its errors instead of using the GENERIC messages described here.
To include arguments into your message string, use the sprintf() function from the C standard library to format a string into a temporary buffer, and then supply the buffer as the argument to IDL_Message(). For example, executing the code:
char buf[128]
int unit = 23
sprintf(buf, "Help! Error number %d.", unit)
IDL_Message(IDL_M_GENERIC, IDL_MSG_LONGJMP, buf)
interrupts the current routine and issues the message:
% Help! Error number 23.