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

Public MSBuild items for native linker arguments. #21331

Open
rolfbjarne opened this issue Sep 30, 2024 · 0 comments
Open

Public MSBuild items for native linker arguments. #21331

rolfbjarne opened this issue Sep 30, 2024 · 0 comments
Labels
enhancement The issue or pull request is an enhancement
Milestone

Comments

@rolfbjarne
Copy link
Member

We've had private (underscore-prefixed) item groups for certain native linker arguments, but we keep having to access them to provide workarounds for various bugs.

At this point we should come up with public item groups, for when we're linking the native executable:

  1. General arguments to the native linker.
  2. Frameworks to link with.

General arguments

NativeAOT uses the LinkerArg property, which IMHO we shouldn't use because:

  • It's a property, and runs into quoting problems, because it's just one value with all the linker arguments.
  • It's a property, so it's much harder to manipulate (say you want to remove a linker argument, for whatever reason).
  • It's abbreviated, which our (admittedly C#) naming guidelines say we shouldn't do.

Other options:

  • LinkerArgument
  • LinkerFlag
  • NativeLinkerArgument (somewhat long?)
  • NativeLinkerFlag (slightly less long)

Frameworks

NativeAOT doesn't really have an equivalent for frameworks, but it has the NativeLibrary item group to link with static libraries (although it might work with frameworks too).

Once again I think we should pick a different name, mostly because the semantics might get confusing and incorrect between us and NativeAOT.

Other options:

  • Framework
  • LinkWithFramework
  • NativeFramework

It would also support the IsWeak metadata, to specify whether the framework should be linked weakly (-weak_framework ... or not (-framework ...).

Note: this would not work with xcframeworks, since it's meant to be passed directly to the linker as-is.

Note 2: this would include both system frameworks (-framework UIKit) and paths to user frameworks (-F /path/to/myframework.framework -framework myframework)

Note 3: once again, this is only a linker flag, we won't copy any user frameworks to the app bundle later on.

@rolfbjarne rolfbjarne added the enhancement The issue or pull request is an enhancement label Sep 30, 2024
@rolfbjarne rolfbjarne added this to the .NET 10 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue or pull request is an enhancement
Projects
None yet
Development

No branches or pull requests

1 participant