home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
xco212p.zip
/
DOC
/
OS2API.TXT
< prev
next >
Wrap
Text File
|
1996-03-06
|
3KB
|
81 lines
OS2API.TXT Copyright (c) 1996 xTech Ltd
----------------------------------------------------------------
XDS 2.12 native code
--------------------
(OS/2 Pre-Release)
OS/2 API support
1. Introduction
This file contains the short description of usage of XDS OS/2 API
support in your Modula-2/Oberon-2 programs. This feature is not
covered in the documentation yet, but it already exists in the
pre-release version and we'd like it to be tested.
2. Requirements
This distribution does not include the OS/2 API libraries, which
you should have in order to access the API from your programs.
These libraries are the part of the IBM Developer's Toolkit for OS/2,
which is available on the Developers Connection CD-ROMs.
3. OS/2 API definition module - OS2.DEF
All the API is defined in a single Modula-2 definition module OS2.DEF,
which resides in the DEF subdirectory of the distribution. It is very
large (more than 1Mb) and its symbolic file would be very large too
and would create the big time and memory overhead during compilation.
Fortunately, the original C header files were built using conditional
compilaion sections - you have to define a constant (like INCL_DOSPROCESS)
before including the main OS2.H header file to select the appropriate
section. This idea, as well as constant names, is preserved in XDS.
Thus, to use the OS/2 API call in your program:
A. Declare the option INCL_xxx in the PROJECT file. For example:
:INCL_DOSPROCESS+
B. If your program is a Presentation Manager application, toggle the PM
option ON in the PROJECT file:
+PM
C. Add the module OS2 to the import list of your program. You can use
qualified or unqualified import:
IMPORT OS2; (* qualified *)
FROM OS2 IMPORT DosBeep; (* unqualified *)
D. Now you can insert the required call:
OS2.DosBeep(1000,100); (* qualified *)
DosBeep(1000,100); (* unqualified *)
NOTE 1:
If you have to pass a procedure as a parameter to the API call (a window
procedure, for example), you should specify the "SysCall" calling
convention:
PROCEDURE ["SysCall"] MyWindowProc
( hwnd : HWND;
msg : LONGCARD;
mp1 : MPARAM;
mp2 : MPARAM
) : MRESULT;
NOTE 2:
If your PM application uses resources, you should incorporate the
binary resource file into the executable. You can use the OS/2
resource compiler (RC.EXE).
See also the sample Modula-2 PM application in SAMPLES\PMHELLO subdirectory.
[end of document]