TSDEVELO.PDF

(594 KB) Pobierz
D
EVELOPER
S
G
UIDE
1
TopSpeed
®
For IBM
®
Personal Computers and Compatibles
Developer’s Guide
TopSpeed Corporation
2
T
OP
S
PEED
E
NVIROMENT
Copyright
©
1989-1991, by TopSpeed Corporation. All rights reserved.
TopSpeed
®
is a registered trademark of TopSpeed Corporation.
Other brand or product names are trademarks or registered trademarks of their respective holders.
Printed in the United Kingdom.
Part number 01-01010-3000-0102
10
9
8
7
6
5
4
3
2
1
D
EVELOPER
S
G
UIDE
3
Contents
C
HAPTER
1 ............................................................... 7
Introduction ...........................................................................................................7
C
HAPTER
2 ............................................................... 9
The Project System ...............................................................................................9
Overview ..........................................................................................................9
Smart Linking ..................................................................................................9
SmartMethod Linking ....................................................................................10
Constant Sharing ...........................................................................................10
Type-safe Linking ...........................................................................................10
A Simple Project File .....................................................................................11
Miscellaneous Commands ............................................................................26
Predefined Compilers ....................................................................................30
Memory Models .............................................................................................31
Linking ...........................................................................................................32
Special Project Macros ..................................................................................32
C
HAPTER
3 ............................................................. 35
TopSpeed from the Command Line.....................................................................35
Command Line Overview ..............................................................................35
Compile Mode ...............................................................................................35
Make Mode ....................................................................................................36
Link Mode ......................................................................................................36
Command-line Options ..................................................................................37
TSC Options ..................................................................................................37
Compilation and Project Options ...................................................................38
C
HAPTER
4 ............................................................. 42
Pragmas ..............................................................................................................42
Conventions and Syntax ................................................................................42
Modula-2 Pragma Syntax ..............................................................................43
Pascal Pragma Syntax ..................................................................................44
4
T
OP
S
PEED
E
NVIROMENT
C and C++ Pragma Syntax ............................................................................44
Project System Pragma Syntax .....................................................................44
Pragmas ........................................................................................................44
Call Pragmas .................................................................................................45
Data Pragmas ................................................................................................51
Check Pragmas .............................................................................................56
The expr Pragma ...........................................................................................57
Name Pragmas ..............................................................................................57
Optimize Pragmas .........................................................................................58
Module Pragmas ...........................................................................................61
Option Pragmas .............................................................................................63
Warn Pragmas ...............................................................................................65
The project Pragma .......................................................................................70
The save and restore Pragmas .....................................................................70
Link Pragmas .................................................................................................71
Link_option Pragmas .....................................................................................71
The define Pragma ........................................................................................73
C
HAPTER
5 ............................................................. 74
Conditional Compilation ......................................................................................74
Modula-2 Syntax ............................................................................................74
Pascal Syntax ................................................................................................75
C and C++ Syntax .........................................................................................76
Predefined Identifiers .....................................................................................76
C
HAPTER
6 ............................................................. 78
Segment-based Overlays ....................................................................................78
Overview ........................................................................................................78
Compiling and Running an Overlayed Program ............................................79
Design Considerations ..................................................................................79
Programming for the Overlay Model ..............................................................82
Overlay System API .......................................................................................82
Run-time Errors .............................................................................................83
Limits and System Requirements ..................................................................86
System Requirements ...................................................................................86
D
EVELOPER
S
G
UIDE
5
C
HAPTER
7 ............................................................. 87
Dynamic Link Libraries for OS/2 ..........................................................................87
The Advantages of Dynamic Linking .............................................................87
Pitfalls of Dynamic Linking and their Solution ................................................87
Understanding Dynamic Linking ....................................................................88
Dynamic Linking ............................................................................................91
Creating Programs that use DLLs .................................................................95
Running Programs that use DLLs..................................................................95
An Example ...................................................................................................95
Initialization in a DLL .....................................................................................98
Using INITDLL ...............................................................................................98
Rules and Limitations for DLL Programs .......................................................99
Dynamic Link Loader Error Messages.........................................................100
C
HAPTER
8 ........................................................... 101
Multi-language Programming ............................................................................101
Standard Cross Definition Files ...................................................................101
Creating your own Cross Definition Files .....................................................102
Linking with your own Libraries....................................................................102
Type Equivalents..........................................................................................103
Strings .........................................................................................................104
Enumeration Types ......................................................................................105
Calling Conventions .....................................................................................105
Naming Conventions ...................................................................................106
Library Considerations.................................................................................107
Modula-2 and Pascal Initialization from C....................................................109
Multi-language Object-Oriented Programming ............................................110
Naming of Methods .....................................................................................111
Programming Examples ..............................................................................112
C
HAPTER
9 ........................................................... 113
Interfacing to Third-Party Code .........................................................................113
Interfacing to Existing Code .........................................................................113
Using Stack Frame Libraries........................................................................114
Assembly Language Interface .....................................................................114
Zgłoś jeśli naruszono regulamin