Skip to content
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

Add a warning to building static libraries with naot #6651

Merged
merged 3 commits into from
Feb 14, 2024
Merged
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
10 changes: 9 additions & 1 deletion core/nativeaot/NativeLibrary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Create a .NET class library project using `dotnet new classlib -o NativeLibrary`
## Building shared libraries

```bash
> dotnet publish /p:NativeLib=Shared --use-current-runtime
> dotnet publish --use-current-runtime
```

The above command will drop a shared library (Windows `.dll`, macOS `.dylib`, Linux `.so`) in `./bin/Release/net8.0/[RID]/publish/` folder and will have the same name as the folder in which your source file is present.
Expand Down Expand Up @@ -85,6 +85,14 @@ The sample [source code](Class1.cs) demonstrates common techniques used to stay

## Building static libraries

> [!WARNING]
> It's preferred to build shared libraries than static libraries:
>
> * All code in the loadable module must be compiled with C/C++ compiler version and options that are compatible with native AOT static libraries.
> * It's also not possible to mix multiple native AOT compiled static libraries within the same loadable module.
>
> These problems don't exist when you build a shared library.

```bash
> dotnet publish /p:NativeLib=Static --use-current-runtime
```
Expand Down
Loading