Garmaine Staff asked 2 years ago

In C++ there are following structures

extern "C" {
    struct A_C {
        UINT32 number;
    }

    struct B_C {
        A_C nested;
        A_C* pointer;
    }
}

What is the proper attribute annotation of following C# structures

struct ACs {
    UInt32 number;
}

struct BCs {
    ACs nested;
    ACs pointer;
}

so that BCs.nested will be mapped to B_C.nested and BCs.pointer will map to B_C.pointer?

It can be achieved by implementing ICustomMarshaler but is there a solution without additional procedural code?