home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nt1632.txt < prev    next >
Text File  |  1993-12-31  |  2KB  |  52 lines

  1. Eureka! It works!
  2.  
  3. A MicroFocus COBOL program running in 16-BIT mode calling an IBM C SET++ program running in 32-BIT mode. It was a pure and excitement!!!!
  4.  
  5. NTCOB16.CBL 
  6.      $set ans85 linklib(coblib+os2286)
  7.        identification division.
  8.            program-id. NTCOB16.
  9.        environment division.
  10.        special-names.
  11.                 call-convention 3 is Pascal.
  12.        data division.
  13.        working-storage section.
  14.        77  the-number      pic 9(4) comp-5  value 26.
  15.        77  the-message     pic x(10)        value "Before" & x'00'.
  16.        procedure division.
  17.                 display the-number the-message.
  18.                 call pascal "NTC32" using
  19.                                     by reference the-number
  20.                                     by reference the-message.                                     .
  21.                 display the-number  the-message.
  22.                 stop run.             
  23.  
  24. NTC32.C
  25. #include <stdio.h>
  26. _Far16 _Pascal NTC32(short int * _Seg16 the_number, char * _Seg16 the_mess)
  27. {
  28.    char * the_pointer32;
  29.  
  30.         /* Going from 16:16(16-BIT) to 0:32(32-bit) for the-mess 
  31.                 because printf and stcpy would receive 16:16(16-BIT) address */
  32.  
  33.                 the_pointer32 = the_mess;
  34.  
  35.                 printf("Received parameters: %i, %s", *the_number, the_pointer32);
  36.  
  37.         /* Change parameters to show it works well           */
  38.  
  39.                 *the_number = 39;
  40.                 strcpy(the_pointer32,"After");
  41. }
  42.  
  43. NCT32.DEF
  44. ; DEF for DLL
  45. LIBRARY INITINSTANCE
  46. CODE LOADONCALL         
  47. EXPORTS NTC32 @1
  48.  
  49. Long live to 32-BIT!!!!
  50.  
  51.  
  52.