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

NativeAOT - prior art for infering custom attributes #108101

Closed
yowl opened this issue Sep 21, 2024 · 3 comments
Closed

NativeAOT - prior art for infering custom attributes #108101

yowl opened this issue Sep 21, 2024 · 3 comments
Labels
area-NativeAOT-coreclr question Answer questions and provide assistance, not an issue with source code or documentation.

Comments

@yowl
Copy link
Contributor

yowl commented Sep 21, 2024

I want to ask if anyone thinks there is prior art for this problem, dotnet/runtimelab#2626

In NativeAOT-LLVM, if a library is referenced that contains JSExport, we need to mark it as UnmanagedCallersOnly in addition so we can root it, export it, and get the right calling convention. Example is the Register method created by the JSExport source generator. Rooting can be solved with the RdXmlRootProvider but the other problems are harder. One way is to change the source generator to always add it, and another way, not necessarily correct, is to view this as: "NativeAOT requires additional attributes that the library author might not be aware of", so I was wondering if there is any prior art?

Thanks!

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Sep 21, 2024
Copy link
Contributor

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

@jkotas jkotas added the question Answer questions and provide assistance, not an issue with source code or documentation. label Sep 21, 2024
@yowl
Copy link
Contributor Author

yowl commented Sep 21, 2024

Actually realised that the source generator already creates:

[UnmanagedCallersOnly(EntryPoint = "XpfSimple__GeneratedInitializer__Register_")]
private static void __Register__Export()
{
	__Register_();
}

Which looks like it is for this purpose, I'll close this for now.

@yowl yowl closed this as completed Sep 21, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Sep 21, 2024
@jkotas
Copy link
Member

jkotas commented Sep 21, 2024

Optimized reflection-free interop solutions often want to generate some code based on the whole application view.

In case wasm interop runs into this problem too, prior art in this space:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr question Answer questions and provide assistance, not an issue with source code or documentation.
Projects
Status: No status
Development

No branches or pull requests

2 participants