Skip to content

Commit 85bcff8

Browse files
authored
Merge pull request #1262 from corob-msft/cr-export-ordinal
Add info to satisfy a question about ordinals
2 parents 5f56d98 + 33ab20f commit 85bcff8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/build/reference/exports.md

Lines changed: 9 additions & 2 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: "07/11/2018"
4+
ms.date: "08/20/2018"
55
ms.technology: ["cpp-tools"]
66
ms.topic: "reference"
77
f1_keywords: ["EXPORTS"]
@@ -38,13 +38,20 @@ EXPORTS
3838
func2=func1
3939
```
4040

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:
41+
If the name that you export is from some 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:
4242

4343
```DEF
4444
EXPORTS
4545
func2=other_module.func1
4646
```
4747

48+
If the name that you export is from another module that exports by ordinal, specify the export's ordinal in the DLL by using *other_module.#ordinal_number*. For example, if your DLL exports a function from the other module where it is ordinal 42, and you want callers to use it as `func2`, you would specify:
49+
50+
```DEF
51+
EXPORTS
52+
func2=other_module.#42
53+
```
54+
4855
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.
4956

5057
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.

0 commit comments

Comments
 (0)