Skip to content

Commit 0bf2605

Browse files
committed
Clarify that NativeLibrary can be used for transitive dependencies as well
1 parent 8a1b320 commit 0bf2605

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

docs/core/deploying/native-aot/interop.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ On Windows, Native AOT uses a prepopulated list of direct P/Invoke methods that
4747
4848
### Linking
4949

50-
To statically link against an unmanaged library, you need to specify `<NativeLibrary Include="filename" />` pointing to a `.lib` file on Windows and a `.a` file on Unix-like systems.
50+
To statically link against one or more unmanaged libraries, you need to specify `<NativeLibrary Include="filename" />` pointing to a `.lib` file on Windows and a `.a` file on Unix-like systems for each library.
5151

5252
Examples:
5353

@@ -56,8 +56,11 @@ Examples:
5656
<!-- Generate direct PInvokes for Dependency -->
5757
<DirectPInvoke Include="Dependency" />
5858
<!-- Specify library to link against -->
59-
<NativeLibrary Include="Dependency.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
60-
<NativeLibrary Include="Dependency.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
59+
<NativeLibrary Include="/path/to/Dependency.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
60+
<NativeLibrary Include="/path/to/Dependency.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
61+
<!-- Specify an additional library to link against, if necessary -->
62+
<NativeLibrary Include="/path/to/TransitiveDependency.lib" Condition="$(RuntimeIdentifier.StartsWith('win'))" />
63+
<NativeLibrary Include="/path/to/TransitiveDependency.a" Condition="!$(RuntimeIdentifier.StartsWith('win'))" />
6164
</ItemGroup>
6265
```
6366

0 commit comments

Comments
 (0)