OpenTP1 Version 7 TP1/Client User's Guide TP1/Client/W, TP1/Client/P
The following figure shows the procedure for creating a CUP.
Figure 3-1 Procedure for creating a CUP
Use the Microsoft C compiler (version 6.0 or later) to create CUP object files in the Windows environment. Use the cc command for compilation.
The compiler options required when normal object libraries are used differ from those required when DLLs are used. The following tables show the options required in these two cases.
Table 3-3 Required compiler options (Windows environment and normal object libraries)
TP1/Client version | Option | Meaning |
---|---|---|
TP1/Client/P | /AM | Specifies the memory model. /AM: Medium memory model (The TP1/Client/P library uses the medium memory model for Windows environments.) |
/Zp | Packs structures. | |
/Gw | Creates Windows-specific prolog and epilog. | |
/DDCCLTFAR | Defines the pointer as a far pointer. |
Table 3-4 Required compiler options (Windows environment and DLLs)
TP1/Client version | Option | Meaning |
---|---|---|
TP1/Client/P | /Zp | Packs the structure. |
/Gw | Generates the prolog and epilog dedicated to Windows. | |
/DDCCLTFAR | Defines the pointer as a far pointer. | |
/DDCCLTDLL | Develops a header file provided by TP1/Client/P for a DLL. |
Example command lines for compiling a source program are shown below.
CL /AM /Zp /Gw /DDCCLTFAR /c cup.c CL /AM /Zp /Gw /DDCCLTFAR /c cupsub1.c CL /AM /Zp /Gw /DDCCLTFAR /c cupsub2.c
CL /Zp /Gw /DDCCLTFAR /DDCCLTDLL /c cup.c CL /Zp /Gw /DDCCLTFAR /DDCCLTDLL /c cupsub1.c CL /Zp /Gw /DDCCLTFAR /DDCCLTDLL /c cupsub2.c
In this example, an icon is defined as a resource. Create the resource definition file cup.rc as follows:
CUPI ICON cup.ico
CUPI is an arbitrary name given to the icon. Use the SDKPAINT.EXE tool included in Windows SDK to create the icon file (cup.ico).
Compile the resource definition file (cup.rc) as follows using the Windows SDK resource compiler:
rc /r cup.rc
Executing the above rc command creates the resource file cup.res.
Create the example module definition file cup.def as follows:
NAME CUPEXEC DESCRIPTION 'CUP SAMPLE PROGRAM' EXETYPE WINDOWS STUB 'WINSTUB.EXE' CODE PRELOAD MOVEABLE DATA PRELOAD MOVEABLE HEAPSIZE 1024 STACKSIZE 8192
Specify 8192 or more for STACKSIZE.
Use the LINK command to link the files shown below and create the CUP executable file.
All Rights Reserved. Copyright (C) 2006, 2009, Hitachi, Ltd.