-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlibmain.cpp
More file actions
336 lines (235 loc) · 9.32 KB
/
libmain.cpp
File metadata and controls
336 lines (235 loc) · 9.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/*
Copyright (C) 1998-2007 Emil Maskovsky
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/**
@file
The main DLL entry point (implementation).
@author Emil Maskovsky
*/
/* Framework libraries. */
#include "mx/sysdefs.hpp"
#include "mx/types.hpp"
/* Application specific. */
/**
@mainpage @project
@author @company
@author © @company 2007
@version 0.1
<b>@project</b> is a portable C/C++ framework.
@section contents Contents:
@li @subpage copyright
@li @subpage suppcpp
@li @subpage build
*/
/**
@page copyright Copyright notice
© @company 2007
*/
/**
@page suppcpp Supported and unsupported C++ features
@li @subpage exceptions
@li @subpage namespaces
@li @subpage typeinfo
*/
/**
@page namespaces Namespaces
We support using of namespaces.
*/
/**
@page build Building using makefiles
@section build_make The make build tool - GNU make
There have been considered multiple scenarios, how to provide makefile
processing (which is the most flexible way of building of any project),
including writing own portable makefile tool based on the framework itself
(which of course can then be used to do the same things as with any makefile
processing tool). The main aim is to have portable makefile tool, which can
then be used on near any platform, and which can provide some extended
processing tasks.
At last, there have been made choice to use the <b><i>GNU makefile processing
tool</i></b>, because of its portability (it is available for many platforms,
Windows and Unixes at least) and extreme flexibility (can e.g. dynamically
create makefile rules, supports sub-routines etc.).
The advantage is, that ve can provide only one makefile for each platform and
compiler and not bother with another makefile build tools (nmake, Borland
make, Digital Mars make etc.), but it can be used to build on near any
platform supported by framework.
The minimal version of GNU make required to build provided makefiles is 3.81
(use @code (g)make --version @endcode to see version of installed GNU makefile
tool).
@see http://make.gnu.org/
@section build_compilers Supported compilers
Currently following C++ compilers are supported:
@li @ref build_msvc - versions 6.0 and later
@li @ref build_gcc - Windows, Unix, DOS (DJGPP); versions 2.x and later
@li @ref build_dmc - 32-bit Windows, 16-bit DOS
@li @ref build_bcc - version 5.5 and later
@li @ref build_watcom - 32-bit Windows, 16-bit DOS
@li @ref build_ibmcpp - MVS/TSO (OS390)
@subsection build_msvc Microsoft Visual C++ (MSVC)
Building using MSVC:@n
Run @ref build_make "(g)make" from the @c 'make\\msw\\win32\\msvc(X)'
directory.
Environment variables to be set:
@li @c INCLUDE: MSVC include files
(formatted as <code>"dir1;dir2"</code>).
@li @c LIB: MSVC library path
(formatted as <code>"dir1;dir2"</code>).
@subsection build_gcc GNU C++ compiler (G++)
(http://gcc.gnu.org/)
Building using G++:@n
Run @ref build_make "(g)make" from the @c
'make\\<platform>\\<system>\\gcc' directory.
Environment variables to be set:
@li @c C_INCLUDE_PATH: GCC include files (pure C)
(formatted as <code>"dir1;dir2"</code>).
@li @c CPLUS_INCLUDE_PATH: G++ include files (C++)
(formatted as <code>"dir1;dir2"</code>).
@li @c LIBRARY_PATH: GCC/G++ libraries
(formatted as <code>"dir1;dir2"</code>).
@subsection build_dmc Digital Mars C++ compiler (DMC)
(http://www.digitalmars.com/)
Building using DMC:@n
Run @ref build_make "(g)make" from the @c 'make\\msw\\<system>\\dmc'
directory.
Include, library etc. paths must be set in the initialization file in the
compiler directory.
@subsection build_bcc Borland C++ Compiler (bcc32)
Building using bcc32:@n
Run @ref build_make "(g)make" from the @c 'make\\msw\\win32\\bcc' directory.
Include, library etc. paths must be set in the initialization file in the
compiler directory.
@subsection build_watcom Watcom C++ compiler
(http://www.openwatcom.org/)
Building using Watcom:@n
Run @ref build_make "(g)make" from the @c 'make\\msw\\<system>\\watcom'
directory.
Environment variables to be set:
@li @c WATCOM Watcom root directory.
@li @c INCLUDE Watcom include files
(formatted as <code>"dir1;dir2"</code>).
@subsection build_ibmcpp IBM Mainframe C++ compiler
Building using IBM CPP:@n
Some scripts are prepared in the @c 'make\\zos\\os390' directory, you
might want to adapt it to your conditions.
*/
/**
@page unicode Unicode support in @project
This section briefly describes the state of the Unicode support in the
@project. Read it if you want to know more about how to write programs able
to work with characters from languages other than English.
@ref unicode_what
@section unicode_what What is Unicode?
Unicode is a standard for character encoding which addresses the shortcomings
of the previous, 8 bit standards, by using at least 16 (and possibly 32) bits
for encoding each character. This allows to have at least 65536 characters
(what is called the BMP, or basic multilingual plane) and possible 2^32 of
them instead of the usual 256 and is sufficient to encode all of the world
languages at once. More details about Unicode may be found at
www.unicode.org.
As this solution is obviously preferable to the previous ones (think of
incompatible encodings for the same language, locale chaos and so on), many
modern operating systems support it. The probably first example is Windows NT
which uses only Unicode internally since its very first version.
Writing internationalized programs is much easier with Unicode and, as the
support for it improves, it should become more and more so. Moreover, in the
Windows NT/2000 case, even the program which uses only standard ASCII can
profit from using Unicode because they will work more efficiently - there
will be no need for the system to convert all strings the program uses
to/from Unicode each time a system call is made.
*/
/**
@page terms Defined terms
@anchor RTTI @b RTTI: (R)un-(T)ime (T)ype (I)dentification
(@ref typeinfo "info")
*/
#ifdef MXCPP_MAKEDLL
#ifdef MX_PLATFORM_OS_WIN16
// Create Windows-16 style DLL library.
/**
The DLL entry point of the @project for Windows 16-bit platform.
@param [in] hInstance Handle to DLL module.
@retval TRUE The initialization was done successfully.
@retval FALSE The initialization has failed.
*/
extern "C" BOOL WINAPI LibMain(
HANDLE MX_UNUSED(hInstance),
WORD MX_UNUSED(wDataSegment),
WORD MX_UNUSED(wHeapSize),
LPSTR MX_UNUSED(lpszCmdLine))
{
return TRUE;
}
#else // MX_PLATFORM_OS_WIN16
#ifdef MX_PLATFORM_OS_WINDOWS
// Create Windows-32 style DLL library.
/**
The DLL entry point of the @project for Windows 32-bit and upper platforms.
@param [in] hDllInstance Handle to DLL module.
@param [in] dwReason Reason for calling function.
@param [in] lpReserved Reserved parameter.
@retval TRUE The initialization was done successfully.
@retval FALSE The initialization has failed.
*/
extern "C" MXCPP_DLL_EXPORT BOOL WINAPI DllMain(
const HINSTANCE MX_UNUSED(hDllInstance),
const DWORD MX_UNUSED(dwReason),
const LPVOID MX_UNUSED(lpReserved))
{
#if 0 // Not used at the moment.
// Perform actions based on the reason for calling.
switch (dwReason)
{
case DLL_PROCESS_ATTACH:
{
// Initialize once for each new process.
// Return FALSE to fail DLL load.
/*
MessageBox(NULL, _T("Initialization of the DLL."),
_T("Demo C++ Framework"), MB_OK);
*/
break;
}
case DLL_THREAD_ATTACH:
{
// Do thread-specific initialization.
break;
}
case DLL_THREAD_DETACH:
{
// Do thread-specific cleanup.
break;
}
case DLL_PROCESS_DETACH:
{
// Perform any necessary cleanup.
/*
MessageBox(NULL, _T("De-initialization of the DLL."),
_T("Demo C++ Framework"), MB_OK);
*/
break;
}
}
#endif // if 0
// Successful DLL_PROCESS_ATTACH.
return TRUE;
}
#else // MX_PLATFORM_OS_WINDOWS
#ifdef MX_PLATFORM_OS_UNIX
// No DLL entry point under Unix/Linux.
#else // MX_PLATFORM_OS_UNIX
#error The DLL entry point is not defined for current platform!
#endif // MX_PLATFORM_OS_UNIX
#endif // MX_PLATFORM_OS_WINDOWS
#endif // MX_PLATFORM_OS_WIN16
#endif // MXCPP_MAKEDLL
/* EOF */