#pragma module OVERL_TEST "OVERL_TEST-1-X" /* **++ ** FACILITY: ** ** MODULE DESCRIPTION: ** ** This main module which demonstrate using of calling external procedure ** from non-resident modules, this mechanizm is provided by LIB$FIND_IMAGE_SYMBOL ** routine. External module is pointed by OVERL logicals: ** ** CC overl_test.c ** LINK over_test.obj ** DEFINE/EXEC OVERL dev:[dir]OVERL.EXE ** RUN overl_test.exe ** ** AUTHORS: ** ** Ruslan R. Laishev ** ** CREATION DATE: 3-FEB-2000 ** **-- */ /* ** ** INCLUDE FILES ** */ #include #include #include #include /* **++ ** FUNCTIONAL DESCRIPTION: ** ** A main procedure, call LIB$FIND_IMAGE_SYMBOL for find&load external image into ** a P0 process space, resolving external references, call an external routine. ** ** FORMAL PARAMETERS: ** ** None ** ** RETURN VALUE: ** ** None ** **-- */ #define INIT_SDESC(dsc, len, ptr) {(dsc).dsc$b_dtype = DSC$K_DTYPE_T;\ (dsc).dsc$b_class = DSC$K_CLASS_S; (dsc).dsc$w_length = (short) (len);\ (dsc).dsc$a_pointer = (ptr);} $DESCRIPTOR(overl_file,"OVERL"); $DESCRIPTOR(overl_rtn_sym, "OVERL_RTN"); int (*overl_rtn) (int, struct dsc$descriptor_s *, unsigned short *); void main (void) { int status; char out_buf [ 128 ]; struct dsc$descriptor_s out_buf_dsc; /* **++ ** Find & load external module, resolev external references **-- */ status = lib$find_image_symbol(&overl_file,&overl_rtn_sym,&overl_rtn,0,0); if ( !(1 & status) ) lib$signal(status); /* **++ ** Call overl_rtn () to performs some task **-- */ INIT_SDESC(out_buf_dsc,sizeof(out_buf),out_buf); status = overl_rtn ( 1913, &out_buf_dsc,&out_buf_dsc.dsc$w_length); if ( !(1 & status) ) lib$signal(status); /* **++ ** Output result to SYS$OTUPUT **-- */ status = lib$put_output(&out_buf_dsc); if ( !(1 & status) ) lib$signal(status); }