Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Figure out when a record needs to be generated as a class #59

Open
@Therzok

Description

@Therzok

There are a few scenarios where plain structs were defined as classes in managed land.

Note in this issue the cases where we need to generate a class instead of a struct for Record:

  • GList:
// This native struct cannot be expressed in C#. We need to generate a wrapper class for the struct pointer.
struct List
{
    void *data;
    List *prev, *next;
}

// Managed then becomes
class List
{
     IntPtr native;
     // Methods which interact with the native pointer.

     // In case we want to provide unsafe access to the native data
     unsafe struct ListInternal
     {
          IntPtr data;
          ListInternal* prev, next;
     }

     public unsafe ListInternal *Native => (ListInternal *)native;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions