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;
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:
// Managed then becomes class List { IntPtr native; // Methods which interact with the native pointer.
}