Skip to content

Commit 0d738f6

Browse files
author
mtx48109
committed
Merge branch 'master' of https://github.com/MicrosoftDocs/cpp-docs-pr into formatting-review-pr4
2 parents 5605a96 + bbc6cd2 commit 0d738f6

92 files changed

Lines changed: 505 additions & 781 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/build/reference/exports.md

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "EXPORTS | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "07/11/2018"
55
ms.technology: ["cpp-tools"]
66
ms.topic: "reference"
77
f1_keywords: ["EXPORTS"]
@@ -13,48 +13,56 @@ ms.author: "corob"
1313
ms.workload: ["cplusplus"]
1414
---
1515
# EXPORTS
16+
1617
Introduces a section of one or more export definitions that specify the exported names or ordinals of functions or data. Each definition must be on a separate line.
1718

18-
```
19+
```DEF
1920
EXPORTS
20-
   definition
21+
definition
2122
```
2223

2324
## Remarks
24-
The first `definition` can be on the same line as the `EXPORTS` keyword or on a subsequent line. The .DEF file can contain one or more `EXPORTS` statements.
25-
26-
The syntax for an export `definition` is:
27-
28-
```
29-
30-
entryname[=internalname] [@ordinal [NONAME]] [[PRIVATE] | [DATA]]
31-
```
32-
33-
`entryname` is the function or variable name that you want to export. This is required. If the name that you export differs from the name in the DLL, specify the export's name in the DLL by using `internalname`. For example, if your DLL exports a function `func1` and you want callers to use it as `func2`, you would specify:
34-
35-
```
36-
EXPORTS
37-
   func2=func1
38-
```
39-
40-
Because the Visual C++ compiler uses name decoration for C++ functions, you must either use the decorated name as the `entryname` or `internalname`, or define the exported functions by using `extern "C"` in the source code. The compiler also decorates C functions that use the [__stdcall](../../cpp/stdcall.md) calling convention with an underscore (_) prefix and a suffix composed of the at sign (@) followed by the number of bytes (in decimal) in the argument list.
41-
42-
To find the decorated names produced by the compiler, use the [DUMPBIN](../../build/reference/dumpbin-reference.md) tool or the linker [/MAP](../../build/reference/map-generate-mapfile.md) option. The decorated names are compiler-specific. If you export the decorated names in the .DEF file, executables that link to the DLL must also be built by using the same version of the compiler. This ensures that the decorated names in the caller match the exported names in the .DEF file.
43-
44-
You can use @`ordinal` to specify that a number, and not the function name, will go into the DLL's export table. Many Windows DLLs export ordinals to support legacy code. It was common to use ordinals in 16-bit Windows code, because it can help minimize the size of a DLL. We don’t recommend exporting functions by ordinal unless your DLL’s clients need it for legacy support. Because the .LIB file will contain the mapping between the ordinal and the function, you can use the function name as you normally would in projects that use the DLL.
45-
46-
By using the optional `NONAME` keyword, you can export by ordinal only and reduce the size of the export table in the resulting DLL. However, if you want to use [GetProcAddress](http://msdn.microsoft.com/library/windows/desktop/ms683212.aspx) on the DLL, you must know the ordinal because the name will not be valid.
47-
48-
The optional keyword `PRIVATE` prevents `entryname` from being included in the import library generated by LINK. It does not affect the export in the image also generated by LINK.
49-
50-
The optional keyword `DATA` specifies that an export is data, not code. This example shows how you could export a data variable named `exported_global`:
51-
52-
```
25+
26+
The first *definition* can be on the same line as the `EXPORTS` keyword or on a subsequent line. The .DEF file can contain one or more `EXPORTS` statements.
27+
28+
The syntax for an export *definition* is:
29+
30+
```DEF
31+
entryname[=internal_name|other_module.another_exported_name] [@Ordinal [NONAME]] [[PRIVATE] | [DATA]]
32+
```
33+
34+
*entryname* is the function or variable name that you want to export. This is required. If the name that you export differs from the name in the DLL, specify the export's name in the DLL by using *internal_name*. For example, if your DLL exports a function `func1` and you want callers to use it as `func2`, you would specify:
35+
36+
```DEF
37+
EXPORTS
38+
func2=func1
39+
```
40+
41+
If the name that you export is from other module, specify the export's name in the DLL by using *other_module.exported_name*. For example, if your DLL exports a function `other_module.func1` and you want callers to use it as `func2`, you would specify:
42+
43+
```DEF
44+
EXPORTS
45+
func2=other_module.func1
46+
```
47+
48+
Because the Visual C++ compiler uses name decoration for C++ functions, you must either use the decorated name internal_name or define the exported functions by using extern "C" in the source code. The compiler also decorates C functions that use the [__stdcall](../../cpp/stdcall.md) calling convention with an underscore (_) prefix and a suffix composed of the at sign (@) followed by the number of bytes (in decimal) in the argument list.
49+
50+
To find the decorated names produced by the compiler, use the [DUMPBIN](../../build/reference/dumpbin-reference.md) tool or the linker [/MAP](../../build/reference/map-generate-mapfile.md) option. The decorated names are compiler-specific. If you export the decorated names in the .DEF file, executables that link to the DLL must also be built by using the same version of the compiler. This ensures that the decorated names in the caller match the exported names in the .DEF file.
51+
52+
You can use @*ordinal* to specify that a number, and not the function name, will go into the DLL's export table. Many Windows DLLs export ordinals to support legacy code. It was common to use ordinals in 16-bit Windows code, because it can help minimize the size of a DLL. We don’t recommend exporting functions by ordinal unless your DLL’s clients need it for legacy support. Because the .LIB file will contain the mapping between the ordinal and the function, you can use the function name as you normally would in projects that use the DLL.
53+
54+
By using the optional `NONAME` keyword, you can export by ordinal only and reduce the size of the export table in the resulting DLL. However, if you want to use [GetProcAddress](http://msdn.microsoft.com/library/windows/desktop/ms683212.aspx) on the DLL, you must know the ordinal because the name will not be valid.
55+
56+
The optional keyword `PRIVATE` prevents *entryname* from being included in the import library generated by LINK. It does not affect the export in the image also generated by LINK.
57+
58+
The optional keyword `DATA` specifies that an export is data, not code. This example shows how you could export a data variable named `exported_global`:
59+
60+
```DEF
5361
EXPORTS
54-
   exported_global DATA
62+
exported_global DATA
5563
```
5664

57-
There are four ways to export a definition, listed in recommended order:
65+
There are four ways to export a definition, listed in recommended order:
5866

5967
1. The [__declspec(dllexport)](../../cpp/dllexport-dllimport.md) keyword in the source code
6068

@@ -64,11 +72,11 @@ EXPORTS
6472

6573
4. A [comment](../../preprocessor/comment-c-cpp.md) directive in the source code, of the form `#pragma comment(linker, "/export: definition ")`
6674

67-
All four methods can be used in the same program. When LINK builds a program that contains exports, it also creates an import library, unless an .EXP file is used in the build.
75+
All four methods can be used in the same program. When LINK builds a program that contains exports, it also creates an import library, unless an .EXP file is used in the build.
6876

69-
Here's an example of an EXPORTS section:
77+
Here's an example of an EXPORTS section:
7078

71-
```
79+
```DEF
7280
EXPORTS
7381
DllCanUnloadNow @1 PRIVATE
7482
DllWindowName = WindowName DATA
@@ -77,7 +85,8 @@ EXPORTS
7785
DllUnregisterServer
7886
```
7987

80-
When you export a variable from a DLL by using a .DEF file, you do not have to specify `__declspec(dllexport)` on the variable. However, in any file that uses the DLL, you must still use `__declspec(dllimport)` on the declaration of data.
88+
When you export a variable from a DLL by using a .DEF file, you do not have to specify `__declspec(dllexport)` on the variable. However, in any file that uses the DLL, you must still use `__declspec(dllimport)` on the declaration of data.
8189

82-
## See Also
83-
[Rules for Module-Definition Statements](../../build/reference/rules-for-module-definition-statements.md)
90+
## See also
91+
92+
[Rules for Module-Definition Statements](../../build/reference/rules-for-module-definition-statements.md)

docs/data/oledb/accessing-xml-data.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@ There are two separate methods of retrieving XML data from a data source: one us
2525
## Retrieving XML Data Using CStreamRowset
2626
You specify [CStreamRowset](../../data/oledb/cstreamrowset-class.md) as the rowset type in your `CCommand` or `CTable` declaration. You can use it with your own accessor or no accessor, for example:
2727

28-
```
28+
```cpp
2929
CCommand<CAccessor<CMyAccessor>, CStreamRowset> myCmd;
3030
```
3131

3232
-or-
3333

34-
```
34+
```cpp
3535
CCommand<CNoAccessor, CStreamRowset> myCmd;
3636
```
3737

3838
Normally when you call `CCommand::Open` (specifying, for example, `CRowset` as the `TRowset` class), it obtains an `IRowset` pointer. `ICommand::Execute` returns an `IRowset` pointer, which is stored in the `m_spRowset` member of the `CRowset` object. Methods such as `MoveFirst`, `MoveNext`, and `GetData` use that pointer to retrieve the data.
3939

4040
By contrast, when you call `CCommand::Open` (but specify `CStreamRowset` as the `TRowset` class), `ICommand::Execute` returns an `ISequentialStream` pointer, which is stored in the `m_spStream` data member of [CStreamRowset](../../data/oledb/cstreamrowset-class.md). You then use the `Read` method to retrieve the (Unicode string) data in XML format. For example:
4141

42-
```
42+
```cpp
4343
myCmd.m_spStream->Read()
4444
```
4545

@@ -55,13 +55,13 @@ myCmd.m_spStream->Read()
5555

5656
Use `CXMLAccessor` as you would any other accessor class, passing it as a template parameter to `CCommand` or `CTable`:
5757

58-
```
58+
```cpp
5959
CTable<CXMLAccessor, CRowset> rs;
6060
```
6161

6262
Use [GetXMLRowData](../../data/oledb/cxmlaccessor-getxmlrowdata.md) to retrieve data from the table one row at a time, and navigate rows using methods such as `MoveNext`, for example:
6363

64-
```
64+
```cpp
6565
// Open data source, session, and rowset
6666
hr = rs.MoveFirst();
6767

docs/data/oledb/caccessor-class.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@ Represents one of the accessor types.
1717

1818
## Syntax
1919

20-
```
21-
20+
```cpp
2221
template <class T>
2322
class CAccessor : public CAccessorBase, public T
2423
```
2524
2625
#### Parameters
27-
`T`
26+
*T*
2827
The user record class.
2928
3029
## Remarks

docs/data/oledb/caccessorbase-class.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ ms.custom: ""
44
ms.date: "11/04/2016"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
7-
f1_keywords: ["CAccessorBase", "CAccessorBase.Close", "CAccessorBase::Close", "GetHAccessor", "CAccessorBase::GetHAccessor", "CAccessorBase.GetHAccessor",
8-
"CAccessorBase::GetNumAccessors", "GetNumAccessors", "CAccessorBase.GetNumAccessors", "IsAutoAccessor", "CAccessorBase.IsAutoAccessor", "CAccessorBase::IsAutoAccessor",
9-
"CAccessorBase::ReleaseAccessors", "CAccessorBase.ReleaseAccessors", "ReleaseAccessors"]
7+
f1_keywords: ["CAccessorBase", "CAccessorBase.Close", "CAccessorBase::Close", "GetHAccessor", "CAccessorBase::GetHAccessor", "CAccessorBase.GetHAccessor", "CAccessorBase::GetNumAccessors", "GetNumAccessors", "CAccessorBase.GetNumAccessors", "IsAutoAccessor", "CAccessorBase.IsAutoAccessor", "CAccessorBase::IsAutoAccessor","CAccessorBase::ReleaseAccessors", "CAccessorBase.ReleaseAccessors", "ReleaseAccessors"]
108
dev_langs: ["C++"]
119
helpviewer_keywords: ["CAccessorBase class", "Close method", "GetHAccessor method", "GetNumAccessors method", "IsAutoAccessor method", "ReleaseAccessors method"]
1210
ms.assetid: 389b65be-11ca-4ae0-9290-60c621c4982b
@@ -45,7 +43,6 @@ Closes the accessors.
4543

4644
```cpp
4745
void Close();
48-
4946
```
5047

5148
### Remarks
@@ -57,7 +54,7 @@ Retrieves the accessor handle of a specified accessor.
5754
### Syntax
5855

5956
```cpp
60-
HACCESSOR GetHAccessor(ULONG nAccessor) const;
57+
HACCESSOR GetHAccessor(ULONG nAccessor) const;
6158
```
6259
6360
#### Parameters
@@ -74,7 +71,6 @@ Retrieves the number of accessors created by the class.
7471
7572
```cpp
7673
ULONG GetNumAccessors() const;
77-
7874
```
7975

8076
### Return Value
@@ -86,7 +82,7 @@ Returns true if data is automatically retrieved for the accessor during a Move o
8682
### Syntax
8783

8884
```cpp
89-
bool IsAutoAccessor(ULONG nAccessor) const;
85+
bool IsAutoAccessor(ULONG nAccessor) const;
9086
```
9187
9288
#### Parameters
@@ -118,4 +114,4 @@ HRESULT ReleaseAccessors(IUnknown* pUnk);
118114
## See Also
119115
[OLE DB Consumer Templates](../../data/oledb/ole-db-consumer-templates-cpp.md)
120116
[OLE DB Consumer Templates Reference](../../data/oledb/ole-db-consumer-templates-reference.md)
121-
[CAccessorBase Class](../../data/oledb/caccessorbase-class.md)
117+
[CAccessorBase Class](../../data/oledb/caccessorbase-class.md)

docs/data/oledb/caccessorrowset-class.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ ms.custom: ""
44
ms.date: "11/04/2016"
55
ms.technology: ["cpp-data"]
66
ms.topic: "reference"
7-
f1_keywords: ["CAccessorRowset", "ATL.CAccessorRowset", "ATL::CAccessorRowset", "CAccessorRowset.Bind", "CAccessorRowset::Bind",
8-
"CAccessorRowset::CAccessorRowset", "CAccessorRowset.CAccessorRowset", "CAccessorRowset", "ATL.CAccessorRowset.CAccessorRowset", "ATL::CAccessorRowset::CAccessorRowset",
9-
"CAccessorRowset.Close", "CAccessorRowset::Close", "CAccessorRowset::FreeRecordMemory", "CAccessorRowset.FreeRecordMemory", "FreeRecordMemory",
10-
"GetColumnInfo", "CAccessorRowset.GetColumnInfo", "CAccessorRowset::GetColumnInfo"]
7+
f1_keywords: ["CAccessorRowset", "ATL.CAccessorRowset", "ATL::CAccessorRowset", "CAccessorRowset.Bind", "CAccessorRowset::Bind", "CAccessorRowset::CAccessorRowset", "CAccessorRowset.CAccessorRowset", "CAccessorRowset", "ATL.CAccessorRowset.CAccessorRowset", "ATL::CAccessorRowset::CAccessorRowset", "CAccessorRowset.Close", "CAccessorRowset::Close", "CAccessorRowset::FreeRecordMemory", "CAccessorRowset.FreeRecordMemory", "FreeRecordMemory", "GetColumnInfo", "CAccessorRowset.GetColumnInfo", "CAccessorRowset::GetColumnInfo"]
118
dev_langs: ["C++"]
12-
helpviewer_keywords: ["CAccessorRowset class", "CAccessorRowset class, methods", "CAccessorRowset class, members", "Bind method", "CAccessorRowset class, constructor",
13-
"Close method", "FreeRecordMemory method", "GetColumnInfo method"]
9+
helpviewer_keywords: ["CAccessorRowset class", "CAccessorRowset class, methods", "CAccessorRowset class, members", "Bind method", "CAccessorRowset class, constructor", "Close method", "FreeRecordMemory method", "GetColumnInfo method"]
1410
ms.assetid: bd4f58ed-cebf-4d43-8985-1e5fcbf06953
1511
author: "mikeblome"
1612
ms.author: "mblome"
@@ -23,7 +19,7 @@ Encapsulates a rowset and its associated accessors in a single class.
2319

2420
```cpp
2521
template <class TAccessor = CNoAccessor,
26-
template <typename T> class TRowset = CRowset>
22+
template <typename T> class TRowset = CRowset>
2723
class CAccessorRowset : public TAccessor, public TRowset<TAccessor>
2824
```
2925
@@ -59,7 +55,6 @@ Creates the bindings if you specified `bBind` as **false** in [CCommand::Open](.
5955
6056
```cpp
6157
HRESULT Bind();
62-
6358
```
6459

6560
### Return Value
@@ -72,7 +67,6 @@ Initializes the `CAccessorRowset` object.
7267

7368
```cpp
7469
CAccessorRowset();
75-
7670
```
7771

7872
## <a name="close"></a> CAccessorRowset::Close
@@ -82,7 +76,6 @@ Releases any active accessors and the rowset.
8276

8377
```cpp
8478
void Close();
85-
8679
```
8780

8881
### Remarks
@@ -95,7 +88,6 @@ Frees any columns in the current record that need to be freed.
9588

9689
```cpp
9790
void FreeRecordMemory();
98-
9991
```
10092

10193
## <a name="getcolumninfo"></a> CAccessorRowset::GetColumnInfo
@@ -104,24 +96,24 @@ Gets column information from the opened rowset.
10496
### Syntax
10597

10698
```cpp
107-
HRESULT GetColumnInfo(DBORDINAL* pulColumns,
108-
DBCOLUMNINFO** ppColumnInfo,
109-
LPOLESTR* ppStrings) const;
110-
111-
HRESULT GetColumnInfo(DBORDINAL* pColumns,
99+
HRESULT GetColumnInfo(DBORDINAL* pulColumns,
100+
DBCOLUMNINFO** ppColumnInfo,
101+
LPOLESTR* ppStrings) const;
102+
103+
HRESULT GetColumnInfo(DBORDINAL* pColumns,
112104
DBCOLUMNINFO** ppColumnInfo);
113105
```
114106
115107
#### Parameters
116-
See [IColumnsInfo::GetColumnInfo](https://msdn.microsoft.com/en-us/library/ms722704.aspx) in the *OLE DB Programmer's Reference*.
108+
See [IColumnsInfo::GetColumnInfo](https://msdn.microsoft.com/library/ms722704.aspx) in the *OLE DB Programmer's Reference*.
117109
118110
### Return Value
119111
A standard HRESULT.
120112
121113
### Remarks
122114
The user must free the returned column information and string buffer. Use the second version of this method when you use [CDynamicAccessor](../../data/oledb/cdynamicaccessor-class.md) and need to override the bindings.
123115
124-
For more information, see [IColumnsInfo::GetColumnInfo](https://msdn.microsoft.com/en-us/library/ms722704.aspx) in the *OLE DB Programmer's Reference*.
116+
For more information, see [IColumnsInfo::GetColumnInfo](https://msdn.microsoft.com/library/ms722704.aspx) in the *OLE DB Programmer's Reference*.
125117
126118
## See Also
127119
[OLE DB Consumer Templates](../../data/oledb/ole-db-consumer-templates-cpp.md)

0 commit comments

Comments
 (0)