Skip to content

NativeAOT: exportable static fields support #88598

@RalfKornmannEnvision

Description

@RalfKornmannEnvision

To use the DirectX12 Agility SDK the executable needs to export two constants

https://devblogs.microsoft.com/directx/gettingstarted-dx12agility/#parametersa

Currently it is only possible to export methods by using the UnmanagedCallersOnly attribute

https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedcallersonlyattribute?view=net-7.0

It's possible to export constants from a native AOT executable by linking it with a static lib that contains these. But you need to make sure that anything else in this lib is actually used so that the linker does not drop it.

It would be nice if there would be a way to have these constants directly in a C# code file instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions