Skip to content

Handle 'lib' variants in ModuleNameVariations to generate DirectPInvokes #118285

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

Merged
merged 8 commits into from
Aug 5, 2025

Conversation

jtschuster
Copy link
Member

In ILC, when a DirectPInvokes item was prefixed with 'lib', it wouldn't recognize the library and wouldn't generate a direct pinvoke. There are a lot of places within the repo (and I assume other codebases) that use the 'lib' prefix in DirectPInvokes, so it seems to make more sense to handle that case rather than remove the prefix from all usages.

fixes #118284

@jtschuster jtschuster added this to the 10.0.0 milestone Aug 1, 2025
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Aug 1, 2025
@jtschuster jtschuster added area-NativeAOT-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Aug 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the ILC (ILCompiler) wasn't recognizing library names with the 'lib' prefix when generating DirectPInvokes. The fix enhances the ModuleNameVariations method to handle library name variations that include the common 'lib' prefix.

Key changes:

  • Added logic to detect and handle the 'lib' prefix in library names
  • Generate additional name variations by stripping the 'lib' prefix
  • Handle cases where both 'lib' prefix and shared library extensions are present

Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

@jkotas
Copy link
Member

jkotas commented Aug 1, 2025

Drop the lib prefixes in https://github.com/dotnet/runtime/blob/main/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets#L151 to make the msbuild targets simpler?

@jtschuster jtschuster merged commit 1bfcb85 into dotnet:main Aug 5, 2025
90 checks passed
@github-project-automation github-project-automation bot moved this to Done in AppModel Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ilc doesn't recognize library names prefixed with 'lib' for DirectPInvokes
2 participants