Skip to content

Ability to generate header file from exports #100747

Open
@am11

Description

@am11

Methods decorated with [UnmanagedCallersOnly(EntryPoint="export-name")] end up as exported symbols in published binary. Since ILC has all the required info related to method signatures and beyond, it can generate a plain C header file {outputFileName}.h with exported APIs accurately for user convenience.

The main work it entails is C# to C type mapping (int->int32_t etc. with inttypes.h, stdbool.h includes), generating enums and generating complex object graphs representation in terms of structs. This feature can be enabled behind an optional project property <GenerateCHeaderFile>true. Further customization may not required and ilc can be opinionated about the style choice (e.g. all definitions stuffed in one header file).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions