-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New custom attribute required to support C++ inline namespaces #783
Comments
Couple of questions. Is this only emitted for assemblies? Can this also be emitted for modules?
So when I have a Do you expect other compilers (such as C#) to honor this attribute? |
In theory, yes, we could build a .netmodule though we don't officially support it. An explanation of how inline namespaces work is at https://foonathan.net/2018/11/inline-namespaces/ We don't expect other compilers to do anything with this custom attribute, hence its location in VisualC.dll. |
Excellent, that helps! We're reviewing API requests once a week on Tuesdays. So expect an answer by EOD the upcoming Tuesday. |
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
public sealed class CppInlineNamespaceAttribute : Attribute
{
public CppInlineNamespaceAttribute(string dottedName);
}
} |
We went with a different design based on @jkotas feedback. I'll close this issue. |
Namespaces in .NET are not a first class concept in metadata but are implicit in type names. C++ inline namespaces are namespaces whose contents are implicitly available in the enclosing namespace. E.g.
The type
R
is simply nameN.I.R
in the metadata and upon import the C++ compiler does not know whetherI
is an inline namespace or not. To help the compiler import this correctly, an assembly-level custom attribute is emitted to the assembly for every inline namespace in the assembly. E.g., for the above we would emitTo implement this, we need the attribute
System.Runtime.CompilerServices.CppInlineNamespaceAttribute
in System.Runtime.CompilerServices.VisualC.dll:An explanation of how inline namespaces work is at https://foonathan.net/2018/11/inline-namespaces:
The text was updated successfully, but these errors were encountered: