home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xc212os2.zip / DOC / OS2API.TXT < prev    next >
Text File  |  1996-03-06  |  3KB  |  81 lines

  1. OS2API.TXT                          Copyright (c) 1996 xTech Ltd
  2. ----------------------------------------------------------------
  3.  
  4.                       XDS 2.12 native code
  5.                       --------------------
  6.                    (OS/2 Pre-Release)
  7.  
  8.                         OS/2 API support
  9.                        
  10. 1. Introduction
  11.  
  12. This file contains the short description of usage of XDS OS/2 API 
  13. support in your Modula-2/Oberon-2 programs. This feature is not 
  14. covered in the documentation yet, but it already exists in the 
  15. pre-release version and we'd like it to be tested.
  16.  
  17. 2. Requirements
  18.  
  19. This distribution does not include the OS/2 API libraries, which
  20. you should have in order to access the API from your programs. 
  21. These libraries are the part of the IBM Developer's Toolkit for OS/2,
  22. which is available on the Developers Connection CD-ROMs.
  23.  
  24. 3. OS/2 API definition module - OS2.DEF
  25.  
  26. All the API is defined in a single Modula-2 definition module OS2.DEF,
  27. which resides in the DEF subdirectory of the distribution. It is very
  28. large (more than 1Mb) and its symbolic file would be very large too
  29. and would create the big time and memory overhead during compilation.
  30. Fortunately, the original C header files were built using conditional 
  31. compilaion sections - you have to define a constant (like INCL_DOSPROCESS)
  32. before including the main OS2.H header file to select the appropriate
  33. section. This idea, as well as constant names, is preserved in XDS.
  34.  
  35. Thus, to use the OS/2 API call in your program:
  36.                        
  37. A. Declare the option INCL_xxx in the PROJECT file. For example:
  38.  
  39. :INCL_DOSPROCESS+
  40.  
  41. B. If your program is a Presentation Manager application, toggle the PM 
  42.    option ON in the PROJECT file:
  43.    
  44. +PM   
  45.  
  46. C. Add the module OS2 to the import list of your program. You can use
  47.    qualified or unqualified import:
  48.  
  49. IMPORT OS2;                 (* qualified *)
  50.  
  51. FROM OS2 IMPORT DosBeep;    (* unqualified *)
  52.  
  53. D. Now you can insert the required call:
  54.  
  55. OS2.DosBeep(1000,100);      (* qualified *)
  56.  
  57. DosBeep(1000,100);          (* unqualified *)
  58.  
  59. NOTE 1:
  60.  
  61.    If you have to pass a procedure as a parameter to the API call (a window
  62.    procedure, for example), you should specify the "SysCall" calling 
  63.    convention: 
  64.       
  65.    PROCEDURE ["SysCall"] MyWindowProc
  66.    ( hwnd         : HWND;
  67.      msg          : LONGCARD;
  68.      mp1          : MPARAM;
  69.      mp2          : MPARAM
  70.    )              : MRESULT;
  71.  
  72. NOTE 2:
  73.  
  74.    If your PM application uses resources, you should incorporate the
  75.    binary resource file into the executable. You can use the OS/2
  76.    resource compiler (RC.EXE).
  77.  
  78. See also the sample Modula-2 PM application in SAMPLES\PMHELLO subdirectory.
  79.  
  80.             [end of document]
  81.