|
|
1.1 root 1: LANGREAD.TXT File
2: README file for Microsoft(R) Windows NT(TM) SDK (BETA)
3: Development Tools
4: (C) Copyright Microsoft Corporation, 1992
5:
6: This document contains release notes for the developent tools, C/C++
7: language, and libraries provided with the Microsoft(R) Windows NT(TM)
8: Software Development Kit (BETA). The information in this file is newer,
9: and therefore supersedes any similar information in the printed
10: manuals.
11:
12:
13: ================================< Contents >================================
14:
15:
16: This file has six parts:
17:
18: Part Title
19: ---- -----
20: 1 Additional 32-bit Run-time Functions:
21: _find Functions
22: _seterrormode
23: _loaddll
24: _unloaddll
25: _getdllprocaddr
26: _getdiskfree
27: _sleep
28: _beep
29: _getsystime
30: _setsystime
31: _futime
32: _getdrives
33: _get_osfhandle
34: _open_osfhandle
35:
36: 2 Further note on the _beginthread function
37:
38: 3 Notes on "C Language Reference"
39:
40: 4 Linker Options
41:
42: 5 Building Multithreaded Applications and DLLs
43:
44: 6 The WinDebug Graphical Debugger
45:
46: ===============< Part 1: Additional 32-bit Run-time Functions >=========
47:
48: In addition to the 32-bit C run-time functions listed in the appendix
49: to the Programming Techniques manual, the following routines are
50: specific to 32-bit operating systems:
51:
52: _find Functions
53: ***************
54:
55: Description
56: ===========
57: Find the first matching file, find the next matching file, or release
58: resources from previous find operations.
59:
60: #include <io.h>
61:
62: long _findfirst( char *filespec, struct _finddata_t *fileinfo );
63: int _findnext( long handle, struct _finddata_t *fileinfo );
64: int _findclose( long handle );
65:
66: filespec Target file specification (may include
67: wildcards)
68: handle Search handle returned by a previous call to
69: _findfirst
70: fileinfo File information buffer
71:
72: Remarks
73: =======
74: The _findfirst routine returns information about the first instance of
75: a file whose name matches the filename argument. The filename argument
76: may use wildcards (* and ?). Any wildcard combination supported by the
77: host operating system may be used.
78:
79: Information is returned in a _finddata_t structure, defined in IO.H.
80: The _finddata_t structure contains the following elements:
81:
82: Element Description
83: ------- -----------
84: unsigned attrib File attribute
85:
86: time_t time_create Time of file creation (-1 for FAT file
87: systems)
88:
89: time_t time_access Time of last file access (-1 for FAT file
90: systems)
91:
92: time_t time_write Time of last write to file
93:
94: _fsize_t size Length of file in bytes
95:
96: char name[_MAX_FNAME] Null-terminated name of matched
97: file/directory, without the path
98:
99: _MAX_FNAME is defined in STDLIB.H.
100:
101: Unlike its MS-DOS counterpart, _findfirst does not allow the programmer
102: to specify target attributes (_A_RDONLY, etc.) by which to limit the
103: find operation. This attribute is returned in the attrib field of the
104: _finddata_t structure and can have the following values (defined in
105: IO.H):
106:
107: Constant Meaning Value
108: -------- ------- -----
109: _A_ARCH Archive. Set whenever the file 0x20
110: is changed, and cleared by the
111: MS-DOS BACKUP command.
112:
113: _A_HIDDEN Hidden file. Cannot be found 0x02
114: with the MS-DOS DIR command. Returns
115: information about normal files as well
116: as about files with this attribute.
117:
118: _A_NORMAL Normal. File can be read or written 0x00
119: without restriction.
120:
121: _A_RDONLY Read-only. File cannot be opened for 0x01
122: writing, and a file with the same name
123: cannot be created. Returns information
124: about normal files as well as about
125: files with this attribute.
126:
127: _A_SUBDIR Subdirectory. Returns information about 0x10
128: normal files as well as about files
129: with this attribute.
130:
131: _A_SYSTEM System file. Cannot be found with the 0x04
132: MS-DOS DIR command. Returns information
133: about normal files as well as about
134: files with this attribute.
135:
136: The _findnext routine finds the next name, if any, that matches the
137: filespec argument specified in a prior call to _findfirst. The fileinfo
138: argument should point to a structure initialized by a previous call to
139: _findfirst. The contents of the structure will be altered as described
140: above if a match is found.
141:
142: The _findclose routine closes the specified search handle and releases
143: associated resources.
144:
145: The _find functions allow nested calls. For example, if the file found
146: by a call to _findfirst or _findnext is a subdirectory, a new search
147: can then be initiated with another call to _findfirst or _findnext.
148:
149: Return Value
150: ============
151: If successful, the _findfirst function returns a unique search handle
152: identifying the file or group of files matching the filespec
153: specification which can be used in a subsequent call to _findnext or
154: _findclose. Otherwise, it returns -1 and sets errno to one of the
155: following values:
156:
157: Value Description
158: ----- -----------
159: ENOENT filespec could not be matched
160:
161: EINVAL Illegal filename specification
162:
163: If successful, the _findnext and _findclose functions return 0.
164: Otherwise, they return -1 and set errno to ENOENT, indicating that no
165: more matching files could be found. Although each search operation
166: returns its own unique handle, the same
167:
168: _seterrormode
169: *************
170:
171: Description
172: ===========
173: Controls whether the operating system handles hard errors or allows the
174: calling application to handle them.
175:
176: #include <stdlib.h>
177:
178: void _seterrormode( int mode );
179:
180: mode Error mode
181:
182: Remarks
183: =======
184: The mode argument specifies the error-mode flag. If mode is set to
185: _CRIT_ERROR_PROMPT, The system displays an error message prompt
186: indicating that a hard error has occurred. If mode is set to
187: _CRIT_ERROR_FAIL, the system returns the failed call to the calling
188: application with an error indicating the cause.
189:
190: Return Value
191: ============
192: None.
193:
194: _loaddll
195: ********
196:
197: Description
198: ===========
199: Loads the specified DLL into memory.
200:
201: #include <process.h>
202:
203: int _loaddll( char *dllname );
204:
205: dllname Null-terminated string that names the DLL to
206: be loaded.
207:
208: Remarks
209: =======
210: The _loaddll routine loads the specified Dynamic Link Library. If the
211: dllname argument does not include a fully-qualified path name, the
212: library is searched for according to the search path specified by the
213: host operating system.
214:
215: Return Value
216: ============
217: If successful, the _loaddll routine returns a unique handle to the DLL.
218: Otherwise, it returns 0.
219:
220: _unloaddll
221: **********
222:
223: Description
224: ===========
225: Unloads the specified DLL from the current process.
226:
227: #include <process.h>
228:
229: int _unloaddll( int handle );
230:
231: handle Handle to the loaded DLL, from a previous call
232: to _loaddll.
233:
234: Remarks
235: =======
236: The _unloaddll routine unloads the specified DLL. The DLL�s resources
237: may be freed if no other processes are using it.
238:
239: Return Value
240: ============
241: If successful, the _unloaddll routine returns 0. Otherwise, it returns
242: an operating system error code.
243:
244: _getdllprocaddr
245: ***************
246:
247: Description
248: ===========
249: Returns the address of the specified exported DLL function.
250:
251: #include <process.h>
252:
253: int (* _getdllprocaddr(int handle, char *procname, int ordinal))();
254:
255: handle Handle to DLL module that contains the function
256: (returned by previous call to _loaddll)
257:
258: procname Pointer to null-terminated string containing
259: the function name, or NULL if the function's
260: ordinal value is to be used.
261:
262: ordinal Function's ordinal value, or -1 if the
263: function's name is to be used.
264:
265: Remarks
266: =======
267: The _getdllprocaddr routine retrieves the address of exported
268: functions in DLLs. The function can be specified by name or by ordinal
269: value. The retrieved address can then be called as a function pointer.
270:
271: Return Value
272: ============
273: If successful, the _getdllprocaddr function returns a pointer to the
274: function's entry point. Otherwise, it returns NULL.
275:
276: _getdiskfree
277: ************
278:
279: Description
280: ===========
281: Retrieves information about the current or specified disk drive,
282: including the amount of free space on the disk.
283:
284: include <direct.h>
285: include <dos.h>
286:
287: int _getdiskfree( unsigned drive, struct _diskfree_t diskinfo );
288:
289: drive Specified drive number. This argument is 0 for
290: the current drive, or 1-26 for another
291: specified disk drive.
292:
293: diskinfo Disk information structure
294:
295: Remarks
296: =======
297: The _getdiskfree function retrieves information about the specified
298: disk drive. This information is returned in a _diskfree_t structure,
299: which is defined in DIRECT.H and has the following fields:
300:
301: Element Description
302: ------- -----------
303: unsigned total_clusters Total number of clusters on the disk
304:
305: unsigned avail_clusters Total number of free clusters on the disk
306:
307: unsigned sectors_per_cluster Number of sectors per cluster
308:
309: unsigned bytes_per_sector Number of bytes per sector
310:
311: Return Value
312: ============
313: If successful, the _getdiskfree routine returns 0. Otherwise, it
314: returns an operating system error code.
315:
316: _sleep
317: ******
318:
319: Description
320: ===========
321: Delays execution of the current thread or process for a specified
322: interval.
323:
324: include <stdlib.h>
325:
326: void _sleep( unsigned long duration );
327:
328: duration Specifies the relative time, in milliseconds,
329: that the delay is to occur.
330:
331: Remarks
332: =======
333: In multithreaded operating systems, the _sleep routine causes the
334: current thread to enter a waiting state until the specified interval of
335: time has passed. In single- threaded operating systems, the _sleep
336: routine causes the current process to be delayed. During the delay,
337: other threads or processes can continue execution. With MS-DOS, yield
338: messages are sent periodically which can be handled by Windows or other
339: multitasking operating systems.
340:
341: The duration argument indicates the length of the interval in
342: milliseconds. It can also be one of the following two values:
343:
344: Constant Value
345: -------- -----
346: _SLEEP_MINIMUM Function returns immediately
347:
348: _SLEEP_FOREVER Infinite delay
349:
350: Note that in non-preemptive multitasking operating systems (such as
351: Windows), the duration may be longer than specified, since other
352: processes may not return control at the end of the delay.
353:
354: Return Value
355: ============
356: None.
357:
358: _beep
359: *****
360:
361: Description
362: ===========
363: Generates simple tones on the speaker.
364:
365: #include <stdlib.h>
366:
367: void _beep( unsigned frequency, unsigned duration );
368:
369: frequency Specifies the frequency of the sound in hertz.
370: Audible sounds will be generated by frequencies
371: between 37 (25 hex) and 32767 (07FFF hex).
372:
373: duration Specifies the duration of the sound in
374: milliseconds. See the description of the _sleep
375: function for possible values. Note that in
376: non-preemptive multitasking operating systems
377: (such as Windows), the duration may be longer
378: than specified, since other processes may not
379: return control at the end of the delay.
380:
381: Return Value
382: ============
383: None.
384:
385: _getsystime
386: ***********
387:
388: Description
389: ===========
390: Retrieves the current system time.
391:
392: #include <time.h>
393:
394: unsigned _getsystime( struct tm *tmstruct );
395:
396: tmstruct Pointer to a tm time structure containing
397: information about the system date and time.
398:
399: Remarks
400: =======
401: The _getsystime routine fills in a tm time structure (defined in
402: TIME.H) with information about the system date and time. The routine
403: then returns the fractional portion of the nearest second, in
404: milliseconds.
405:
406: Return Value
407: ============
408: The _getsystime function returns the fractional portion of the nearest
409: second, in milliseconds.
410:
411: _setsystime
412: ***********
413:
414: Description
415: ===========
416: Sets the current system time.
417:
418: #include <time.h>
419:
420: unsigned _setsystime( struct tm *tmstruct, unsigned milliseconds );
421:
422: tmstruct Pointer to a tm time structure containing
423: information about the system date and time
424:
425: milliseconds Fractional portion of nearest second, in
426: milliseconds
427:
428: Remarks
429: =======
430: The _setsystime routine sets the current system time to the specified
431: time.
432:
433: Return Value
434: ============
435: If successful, the _setsystime routine returns 0. Otherwise, it
436: returns an operating system error code.
437:
438: _futime
439: *******
440:
441: Description
442: ===========
443: Sets the modification time on an open file.
444:
445: #include <\sys\utime.h>
446:
447: int _futime( int handle, struct _utimbuf *filetime );
448:
449: handle Handle to open file
450:
451: filetime Pointer to structure containing new
452: modification date
453:
454: Remarks
455: =======
456: The _futime routine sets the modification date on the open file
457: associated with handle. It is identical to the _utime function, except
458: that its argument is the handle to an open file, rather than the name
459: of a file or a path to a file. Although the _utimbuf structure contains
460: a field for access time, only the modification time is set with systems
461: that do not support access time (such as MS- DOS).
462:
463: Return Value
464: ============
465: The _futime function returns 0 if successful. A return value of -1
466: indicates an error; in this case, errno is set to EBADF, indicating an
467: invalid file handle.
468:
469: _getdrives
470: **********
471:
472: Description
473: ===========
474: Returns a bitmask representing the currently available disk drives.
475:
476: #include <direct.h>
477:
478: unsigned long _getdrives ( void );
479:
480: Return Value
481: ============
482: The return value is a bit map with bits set for each currently
483: available disk drive. Bit position 0 (the least-significant bit) is
484: drive A, bit position 1 is drive B, bit position 2 is drive C, and so
485: on.
486:
487: _get_osfhandle
488: **************
489:
490: Description
491: ===========
492: Associates an operating system file handle with an existing C run-time
493: file handle.
494:
495: #include <io.h>
496:
497: long _get_osfhandle( int filehandle );
498:
499: filehandle User file handle
500:
501: Return Value
502: ============
503: If successful, the _get_osfhandle routine returns an operating system
504: file handle, corresponding to filehandle. Otherwise, it returns -1 and
505: sets errno to EBADF, indicating an invalid file handle.
506:
507: _open_osfhandle
508: ***************
509:
510: Description
511: ===========
512: Associates a C run-time file handle with an existing operating system
513: file handle.
514:
515: #include <io.h>
516:
517: int _open_osfhandle( long osfhandle, int flags );
518:
519: osfhandle Operating system file handle
520:
521: flags Type of operations allowed
522:
523: Remarks
524: =======
525: The _open_osfhandle routine allocates a C run-time file handle and
526: sets it to point to the operating system file handle specified by
527: osfhandle. The flags argument is an integer expression formed from one
528: or more of the manifest constants defined in FCNTL.H and listed below.
529: When two or more manifest constants are used to form the flags
530: argument, the constants are combined with the bitwise-OR operator (|).
531:
532: The FCNTL.H file defines the following manifest constants:
533:
534: Constant Meaning
535: -------- -------
536: _O_APPEND Repositions the file pointer to the end of the
537: file before every write operation.
538:
539: _O_RDONLY Opens file for reading only.
540:
541: _O_TEXT Opens file in text (translated) mode.
542:
543: Return Value
544: ============
545: If successful, the _open_osfhandle function returns a C run-time file
546: handle. Otherwise, it returns -1.
547:
548:
549: =============< Part 2: Further note on the _beginthread function >==============
550:
551: Windows NT handles the allocation of the stack when the _beginthread
552: routine is called. Therefore, unlike previous 16-bit versions of the
553: function, the programmer does not need to pass the address of the
554: thread stack to _beginthread. The following description supersedes the
555: information in the appendix to the Programming Techniques manual:
556:
557: unsigned long _beginthread( void( *start_address )( void * ), unsigned
558: stack_size, void *arglist );
559:
560: start_address Starting address of thread
561: stack_size Stack size for thread
562: arglist Argument list for thread
563:
564: =====================< Part 3: C Language Reference >================================
565:
566: The following information is 16- and 32-bit specific information that
567: supersedes the information listed on the corresponding pages of the
568: Microsoft C/C++ C Language Reference manual.
569:
570: Page 5
571: The following keywords are not supported for 32-bit targets: __far,
572: __fortran, __huge, __interrupt, __loadds, __pascal, __saveregs,
573: __segment, __self. Limited 32-bit support is available for __based. The
574: __try, __except and __finally keywords are supported only for 32-bit
575: compilations.
576:
577: Page 13
578: For 32-bit targets, the values of long double are the same as for double.
579:
580: Page 48
581: The 32-bit compiler ignores the register keyword.
582:
583: Page 56
584: The 32-bit compiler ignores the use of the __near keyword.
585:
586: Page 57
587: The 32-bit compiler does not allow the use of the __far keyword.
588:
589: Page 57
590: The 32-bit compiler does not allow the use of the __huge keyword.
591:
592: Page 57
593: For 32-bit targets, __based specifies that a pointer is a 32-bit offset
594: from a 32-bit base.
595:
596: Page 57
597: The __fortran and __pascal keywords are not accepted for 32-bit targets.
598:
599: Page 58
600: The __cdecl calling convention is the default for 32-bit targets.
601:
602: Page 58
603: The 32-bit compiler uses the ECX and EDX registers, but Microsoft
604: reserves the right to change the registers and implementation of the
605: __fastcall calling convention between releases of the compiler.
606:
607: Page 59
608: The __segment keyword is not supported by the 32-bit compiler.
609:
610: Page 70
611: The default packing size is 4 for 32-bit targets.
612:
613: Page 71
614: Bit fields default to size long for the 32-bit compiler.
615:
616: Page 76
617: For 32-bit targets, size_t is unsigned long and the __huge keyword is
618: not required.
619:
620: Page 80
621: The __segment type and the built-in function __segname are not
622: supported by the 32-bit compiler.
623:
624: Page 82
625: Pointers based on pointers are the only form of the __based keyword
626: valid in 32-bit compilations. In such compilations, they are 32-bit
627: displacements from a 32-bit base.
628:
629: Page 84
630: Pointers based on __self are not available for 32-bit targets.
631:
632: Page 95
633: On 32-bit computers, sizeof is unsigned long.
634:
635: Page 100
636: The 32-bit compiler maps long double to type double.
637:
638: Page 121
639: The base operator is not supported for 32-bit targets.
640:
641: Page 169
642: The use of the __near keyword is ignored by the 32-bit compiler.
643:
644: Page 169
645: The use of the __far keyword is illegal for 32-bit targets.
646:
647: Page 170
648: The __fortran and __pascal keywords are illegal for 32-bit targets.
649:
650: Page 175
651: For 16-bit targets, the __interrupt keyword specifies that the function
652: is an interrupt handler. The compiler generates appropriate entry and
653: exit sequences for the handling function, including saving and
654: restoring all registers and executing an IRET instruction to return.
655: Use this form to specify an interrupt function:
656:
657: __interrupt declarator
658:
659: where declarator is the name of the function to be called. An interrupt
660: function must be __far. If you are compiling with the small (default)
661: or compact memory model, you must explicitly declare the function with
662: the __far attribute. An interrupt function cannot be declared as an
663: inline function.
664:
665: Interrupt functions must observe the C calling convention. If you use
666: the /Gc compiler option (forcing the __pascal or __fortran calling
667: convention) or the /Gr compiler option (forcing the __fastcall calling
668: convention), you must explicitly declare your interrupt-handling
669: function with the __cdecl attribute.
670:
671: You cannot declare an interrupt function with both the __interrupt
672: attribute and the __saveregs attribute or the __fastcall calling
673: convention.
674:
675: This example statement declares a function pointer that can be used to
676: point to an interrupt handler:
677:
678: void ( __interrupt __far *oldtime ) ( void );
679:
680: Page 175
681: The __interrupt keyword is illegal in 32-bit targets. See Help for
682: more information on writing interrupt functions.
683:
684: Page 176
685: The __loadds keyword is not supported in 32-bit targets.
686:
687: Page 176
688: The __saveregs keyword is not supported in 32-bit targets.
689:
690: Page 199
691: The following predefined macros are for 16-bit targets only:
692:
693: Identifier Function
694: ---------- --------
695: _DLL Code for run-time library as a dynamic-link
696: library. Defined when /MD is specified. (For
697: 16-bit targets only.)
698:
699: _FAST Fast-compile. Defined when /f is specified
700: (the default). Supersedes _QC, which is still
701: supported but not recommended. Using /Od causes
702: CL to compile your program with /f. The /f
703: option compiles source files without any default
704: optimizations.(For 16-bit targets only.)
705:
706: M_I8086, _M_I8086 Defined for 8086 and 8088 processors (default
707: or /G0 option) (For 16-bit targets only.)
708:
709: M_I286, _M_I286 Defined for 80286 processor (/G1 or /G2 option).
710: (For 16-bit targets only.)
711:
712: M_I86mM, _M_I86mM Always defined. Identifies memory model, where
713: `m' is either T (tiny model), S (small model),
714: C (compact model), M (medium model), L (large
715: model), or H (huge model). Defined by /AT, /AS,
716: /AC, /AM, /AL and /AH, respectively. If huge
717: model is used, both M_I86LM and M_I86HM are
718: defined. Small model is the default. (For
719: 16-bit targets only.)
720:
721: _PCODE Defined for sections of code that are compiled
722: as pcode. Defined when /Oq is enabled. (For
723: 16-bit targets only.)
724:
725: _QC Supported for compatibility with Microsoft C
726: version 6.0. The _FAST macro (or /f) is the
727: default for C8 and is the recommended
728: alternative. (For 16-bit targets only.)
729:
730: _WINDLL Windows protected-mode dynamic-link library is
731: selected with /GD. (For 16-bit targets only.)
732:
733: _WINDOWS Windows protected mode is selected with /GA,
734: /Gn, /GW, /Mq, or /GD. (For 16-bit targets
735: only.)
736:
737: Page 199
738: The following predefined macro is for 32-bit targets only:
739:
740: Identifier Function
741: ---------- --------
742: _M_IX86 Defined as 300 for the 80386 processor (/G3
743: option) and as 400 for the 80486 (/G4) processor.
744:
745: Page 210
746: The following pragmas are for 16-bit targets only:
747:
748: #pragma check_pointer ([[{ on | off }]])
749: ----------------------------------------
750: Instructs the compiler to turn off pointer checking if off is
751: specified, or to turn on pointer checking if on is specified. If turned
752: on, this pragma causes the compiler to check every pointer dereference
753: to make sure the pointer is not a null or out- of-range pointer. The
754: check_pointer pragma is also enabled with the /Zr command-line option,
755: which is only available with the /f option. If you do not specify
756: either on or off, the effect of check_pointer is to reverse the
757: current state of pointer checking. If pointer checking is on, it is
758: turned off and vice versa.
759:
760: This pragma works function by function, not statement by statement. To
761: use this pragma, place a pair of check_pointer pragmas around any
762: function definition that contains pointer usage you want to check.
763:
764: #pragma code_seg ( [[ "segment-name" [[, "segment-class"]] )
765: ------------------------------------------------------------
766: Specifies a segment where functions are to be allocated, allowing the
767: use of based allocation without rewriting code. The code_seg pragma
768: specifies the default segment for functions. This is equivalent to
769: using the /NT (name of TEXT segment) compilation option. It is also
770: equivalent to specifying functions as based. You can, optionally,
771: specify the class as well as the segment name. For example:
772:
773: #pragma code_seg( "MY_CODE", "CODE" )
774:
775: The preceding example causes functions following to be allocated in a
776: segment called MY_CODE. The segment is given a CODE class.
777:
778: Specifying the code_seg pragma with no arguments causes the compiler
779: to allocate all following functions in the default code segment called
780: MY_CODE. The segment is given a CODE class.
781:
782: Note
783: ----
784: There is no way to specify the segment class using based function
785: allocation or the /NT compilation option.
786:
787: Functions allocated using the /NT option or code_seg pragma do not
788: retain any information about their location. However, functions
789: allocated using the based function-allocation syntax retain that
790: information in their external name.
791:
792: #pragma data_seg ( [[ "segment-name"[[, "segment-class"]] )
793: -----------------------------------------------------------
794: Specifies the default segment for data. This is equivalent to using the
795: /ND (name of DATA segment) compilation option. It is also equivalent to
796: specifying objects or pointers as based. You can, optionally, specify
797: the class as well as the segment name. For example:
798:
799: #pragma data_seg( "MY_DATA", "DATA" )
800:
801: The preceding example causes functions following to be allocated in a
802: segment called MY_DATA. The segment is given a DATA class.
803:
804: Specifying the data_seg pragma with no arguments causes the compiler
805: to allocate all following data in the default data segment called
806: MY_DATA. The segment is given a DATA class.
807:
808: Note
809: ----
810: There is no way to specify the segment class using based function
811: allocation or the /ND compilation option.
812:
813: Data allocated using the /ND option or data_seg pragma do not retain
814: any information about their location. However, data allocated using the
815: based syntax retain that information in their external name.
816:
817: If you compile with /Za, the data_seg pragma does not affect the
818: allocation of uninitialized objects. This is true under /Za. However,
819: under /Ze the uninitialized objects also get allocated in the segment
820: specified by the data_seg pragma.
821:
822: #pragma native_caller ( [[ { on | off } ]] )
823: --------------------------------------------
824: Controls the removal of native-code entry points from within source
825: code on a function by function basis. To suppress all native entry
826: points, use the /Gn command-line option. See the Programming Techniques
827: manual for more information about p-code.
828:
829: Page 210
830: #pragma alloc_text( textsegment, function1, ...)
831: ------------------------------------------------
832: Names the segment where the specified function definitions are to
833: reside. This must occur between a function declarator and the function
834: definition for the named functions.
835:
836: The recommended technique for functions in 16-bit targets is to use
837: __based to specify the function location.
838:
839: Use the alloc_text pragma for 32-bit targets since __based is not
840: supported for functions in 32-bit targets.
841:
842: Page 211
843: #pragma intrinsic( function1 [[, function2, ...]] )
844: ---------------------------------------------------
845: Specifies that calls to the specified functions are intrinsic (a
846: library function known to the compiler). Alternatively, you can use the
847: /Oi option to make intrinsic the default for functions that have
848: intrinsic forms. In this case, you can use the function pragma to
849: override /Oi for specified functions. This pragma cannot be used with
850: /f. This pragma takes effect at the first function defined after the
851: pragma is seen.
852:
853: The following functions have intrinsic forms for both the 16-bit and
854: 32-bit compilers:
855:
856: _alloca
857: _disable
858: _enable
859: _inp
860: _inpw
861: _lrotl
862: _lrotr
863: _outp
864: _outpw
865: _rotl
866: _rotr
867: _strset
868: abs
869: acos
870: asin
871: atan
872: atan2
873: ceil
874: cos
875: cosh
876: exp
877: fabs
878: floor
879: fmod
880: labs
881: log
882: log10
883: memcmp
884: memcpy
885: memset
886: pow
887: sin
888: sinh
889: sqrt
890: strcat
891: strcmp
892: strcpy
893: strlen
894: tan
895: tanh
896:
897: The following functions have intrinsic forms for the 16-bit compiler
898: only:
899:
900: _acosl
901: _asinl
902: _atanl
903: _atan2l
904: _ceill
905: _cosl
906: _coshl
907: _expl
908: _floorl
909: _fmodl
910: _logl
911: _log10l
912: _powl
913: _sinl
914: _sinhl
915: _sqrtl
916: _tanl
917: _tanhl
918: _fmemcmp
919: _fmemcpy
920: _fmemset
921: _fstrcat
922: _fstrcmp
923: _fstrcpy
924: _fstrlen
925: _fstrsetu
926:
927: Page 212
928: #pragma optimize( "[[optimization-option-list]]", {off | on } )
929: ---------------------------------------------------------------
930: Specifies optimizations to be performed. Must appear outside a
931: function. The optimization option list may be zero or more of the
932: following: a, c, e, g, l, n, p, q, t, and w. These letters correspond
933: to the /O compilation options. This pragma takes effect at the first
934: function defined after the pragma is seen. The optimization list for
935: 32-bit targets may be zero or more of the following: a, g, n, p, t, and
936: w.
937:
938: Page 212
939: #pragma pack( [[{1 | 2 | 4 | 8 | 16 }]] )
940: -----------------------------------------
941: Specifies packing alignment for structure types. You can use the /Zp
942: option to specify the same packing for all structures in a module. The
943: default is 2 for 16- bit targets and 4 for 32-bit targets.
944:
945: When you give the /Zpn option, where n is 1, 2, 4, 8, or 16, each
946: structure member after the first is stored on n-byte boundaries,
947: depending on the number you choose. If you use the /Zp option without
948: an argument, structure members are packed on one-byte boundaries. No
949: space is allowed between /Zp and its argument. This pragma takes effect
950: at the first function defined after the pragma is seen.
951:
952: On 32-bit targets, the packing can be set at 8 or 16 as well as 1, 2,
953: or 4 as given for 16-bit targets.
954:
955: Page 240
956: For the 32-bit compiler, long double and double are the same.
957:
958: ========================< Part 4: Linker Options >===========================
959:
960: Throughout Programming Techniques (Chapter 1: Building Applications
961: and DLLs) and Tools (Chapter 5: Linker), the NOTMAPPED parameter for
962: the LINK and COFF /DEBUG: option is incorrectly given as "NOMAPPED."
963: The correct syntax for the /DEBUG option is:
964:
965: /DEBUG:[{MAPPED|NOTMAPPED},]{NONE|MINIMAL|PARTIAL|FULL}
966:
967:
968: =============< Part 5: Building Multithreaded Applications and DLLs >============
969:
970:
971: The following information should be added to Programming Techniques
972: Chapter 1: Building Applications and DLLs:
973:
974: Building Multithreaded Programs
975: -------------------------------
976: Building a multithreaded program is only slightly different from
977: building a single-threaded program. Two additional parameters must be
978: specified:
979:
980: 1. Compile with the /D_MT option.
981:
982: 2. Link with LIBCMT.LIB (multithread C run-time library) instead
983: of LIBC.LIB (single-thread C run-time library).
984:
985: Using the C Run-Time DLL
986: ------------------------
987: You can reduce the size of an executable file by using the C run-time
988: DLL instead of statically linking the C run-time libraries to the
989: program. The cost is a small startup overhead to initialize the DLL,
990: and the normal DLL calling overhead.
991:
992: To use the C run-time DLL (CRTDLL.DLL) with either a single- threaded
993: or multithreaded program, link with CRTDLL.LIB. Do not link with either
994: LIBC.LIB or LIBCMT.LIB. The C run-time DLL supports both types of
995: programs.
996:
997:
998: =============< Part 6: The WinDebug Graphical Debugger >=============
999:
1000:
1001: Loading Programs
1002: ----------------
1003:
1004: NOTE: The Program menu is disabled in this version of WinDebug. To
1005: load a program for debugging, you must enter the program
1006: name on the command-line when you start the debugger. For
1007: example:
1008:
1009: WINDBG MYPROG.EXE
1010:
1011: WINDBG C:\BUILDDIR\TESTOR.EXE
1012:
1013:
1014:
1015: Expression Evaluator
1016: --------------------
1017:
1018: The expression evaluator in this release of WinDebug cannot
1019: evaluate a type-cast followed by the following characters: *, &,
1020: +, and |. You can acheive the same meaning by enclosing the casted
1021: expression in parenthesis. For example:
1022:
1023: (char *) &i
1024:
1025: would become
1026:
1027: (char *) (&i)
1028:
1029:
1030:
1031: Command Window
1032: --------------
1033:
1034: Command Window Editing
1035: ----------------------
1036: In the Command window, you can use editing keys similar to those
1037: available from the NT command prompt. The Up- and Down-Arrow keys let
1038: You retrieve previously-entered WinDebug commands. You can edit the
1039: current command line with the Backspace, Delete, Insert, and Left-
1040: and Right-Arrow keys.
1041:
1042:
1043: Process Specifiers
1044: ------------------
1045:
1046: The process-specifier syntax should be as follows:
1047:
1048: Symbol Description
1049: ------ -----------
1050: |. The current process.
1051: |number The process number.
1052: |* All processes.
1053:
1054:
1055: Set Breakpoint (BP)
1056: ------------------
1057:
1058: The Set Breakpoint (BP) options /M and /H are not available in this
1059: release.
1060:
1061: With the /C option, you must enclose the semicolon-separated list
1062: of multiple commands in quotation marks.
1063:
1064:
1065: Enter ANSI Characters (EA)
1066: --------------------------
1067:
1068: If you want to include space (" ") characters, you must enclose
1069: the character string in quotation marks (" or '). If you enclose
1070: the string in double quotation marks, WinDebug will automatically
1071: null-terminate the string. Single quotation marks (') will not add
1072: a null character.
1073:
1074:
1075: Display and Entry Commands (D* and E*)
1076: --------------------------------------
1077:
1078: The display and entry commands (such as DD and EB) will use the
1079: current default radix. You can enter numbers with a different radix
1080: by using the standard C/C++ radix overrides (such as 0x).
1081:
1082:
1083: Find and Search (F and S)
1084: -------------------------
1085:
1086: These commands are unavailable in this release.
1087:
1088:
1089: Display Stack Backtrace (K)
1090: ---------------------------
1091:
1092: This command can be used when handling an exception.
1093:
1094:
1095: Set Exceptions (SX*)
1096: --------------------
1097:
1098: These commands can be followed by /C2<commandlist>, where
1099: <commandlist> is a quote-enclosed, semicolon-separated list of
1100: WinDebug commands to execute after an exception is handled. The
1101: SXE command can also be followed by /C<commandlist>, where
1102: <commandlist> specifies commands to execute before an exception
1103: triggers the debugger.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.