dotnet / dotnet/macios

Add support for a additional linker flags for libraries in NuGets

Open
#17,665 0 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 12h
Merged PRs (30d)
123

Description

We have support for custom linker flags creating NuGets from binding projects: they're stored either in a LinkWith attribute in the assembly or a manifest next to the assembly or in a binding resource package.

However, we don't have any support for additional linker flags when we link with libraries from a NuGet that don't come from a binding project (those automatically added to ResolvedFileToPublish by NuGet's logic, see https://github.com/xamarin/xamarin-macios/blob/main/dotnet/BundleContents.md for more info).

This is particularly common for NuGets that have support for numerous platforms, in which case the native library will likely be a C library, and not have any specific binding code for our platforms.

We should come up with a solution here.

Idea: add support for a manifest file next to the library. This file would have the same format as our other manifest file.

Example manifest file:

```xml



CoreLocation Foundation ModelIO

Static




```

this file would be next to wherever `libtest.a` is in the NuGet (named `libtest.manifest`).

In theory these linker flags are only needed for static libraries, not for dylibs nor xcframeworks, but it should be trivial to add support for the manifest file for all types of libraries, so we should just do that as well (this could become useful if we use the manifest file to store more information in the future).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.