At a minimum, the user-written module must contain: o #include statements for DESCRIP.H and SDA_ROUTINES.H o The global variable SDA$EXTEND_VERSION, initialized as follows: int sda$extend_version = SDA_FLAGS$K_VERSION; o The routine SDA$EXTEND (prototype follows) Optionally, the user-written module may also contain the statement: #define __NEW_STARLET You should use this option because it provides type checking of function arguments and gives consistency in casing and naming conventions. The entry point in the user-written module, SDA$EXTEND, is called as a routine with three arguments and no return value. The declaration is as follows: void sda$extend ( int *transfer_table, struct dsc$descriptor_s *cmd_line, SDA_FLAGS sda_flags) The arguments in this code example have the following meanings: Table 3-1 SDA$EXTEND Arguments Line of Code Meaning transfer_ Address of the vector table in the base image. The table user-written routine SDA$EXTEND must copy this to SDA$VECTOR_TABLE (declared in SDA_ROUTINES.H) before any SDA routines can be called. cmd_line Address of the descriptor of the command line as entered by the user, less the name of the extension. So, if you enter "SDA> MBX" or "SDA> DO MBX", the command line is a zero length string. If you enter the command "SDA> MBX 80102030", the command line is " 80102030" (the separating space is not stripped). sda_flags Definition for the following four bits in this structure: Bit Meaning sda_flags.sda_ Indicates SDA has been activated flags$v_override with the ANALYZE/CRASH_ DUMP/OVERRIDE command sda_flags.sda_ Indicates SDA has been activated flags$v_current with the ANALYZE/SYSTEM command or was invoked from the kept debugger during an SCD session sda_flags.sda_ Indicates that SDA was invoked flags$v_target from the kept debugger during an SCD or SDD session or when analyzing a process dump sda_flags.sda_ Indicates SDA was activated with flags$v_process the ANALYZE/CRASH_DUMP command to analyze a process dump sda_flags.sda_ Indicates that SDA is analyzing an flags$v_ia64 Integrity server system or dump None of the above Indicates SDA was activated with bits set the ANALYZE/CRASH_DUMP command to analyze an Alpha system dump Other bits Reserved to VSI:may be nonzero The first executable statement of the routine must be to copy TRANSFER_TABLE to SDA$VECTOR_TABLE (which is declared in SDA_ ROUTINES.H): sda$vector_table = transfer_table; If this is not done, you cannot call any of the routines described below. Any attempts to call the routines receive a status return of SDA$_VECNOTINIT. (For routines defined not to return a status, this value can be found only by examining the return value directly.) The next statement should be one to establish a condition handler, as it is often difficult to track down errors in extensions such as access violations because the extension is activated dynamically with LIB$FIND_IMAGE_SYMBOL. A default condition handler, SDA$COND_HANDLER, is provided that outputs the following information in the event of an error: o The error condition o The VMS version o A list of activated images, with start and end virtual addresses o The signal array and register dump o The current call frame chain You can establish this condition handler as follows: lib$establish (sda$cond_handler); NOTE The error condition, signal array, and register dump are output directly to SYS$OUTPUT and/or SYS$ERROR, and are not affected by the use of the SDA commands SET OUTPUT and SET LOG. Thus, a minimal extension would be: #define __NEW_STARLET 1 #include <descrip.h> #include <sda_routines.h> int sda$extend_version = SDA_FLAGS$K_VERSION; void sda$extend (int *transfer_table, struct dsc$descriptor_s *cmd_line, SDA_FLAGS sda_flags) { sda$vector_table = transfer_table; lib$establish (sda$cond_handler); sda$print ("hello, world"); return; }