Skip to content

Clarify that NativeLibrary can be used for transitive dependencies #42815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/core/deploying/native-aot/interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ On Windows, Native AOT uses a prepopulated list of direct P/Invoke methods that

### Linking

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

Examples:

Expand All @@ -61,6 +61,10 @@ Examples:
</ItemGroup>
```

If the specified native library has a dependency on other static libraries, then `NativeLibrary` items will need to be added for each of the transitive depenencies as well, otherwise the native linker will fail because of missing symbols.

Platform conventions are followed when it comes to the format of `NativeLibrary` entries. The underlying native linker may search standard library paths or allow rooted file paths.

To specify additional flags to the native linker, use the `<LinkerArg>` item.

Examples:
Expand Down