Need to be able to add dynamically sized arrays as the last field of a type.
#[repr(C)] struct Foo {
blah: Blah,
cbSize: DWORD,
array: [SomeType; N], // This field should be dynamically sized.
}
The user must be able to specify a value for N
when creating such a type, but there must only be one such type, so that FFI functions can easily take a *const Foo
or *mut Foo
.
The user should be able to allocate such a type with relative ease. At a bare minimum it must be possible to easily such a type on the heap, with the size specified at runtime. Ideally it would be allocatable on the stack with a const size. As a pipe dream, it would be neat if it could be allocated on the stack with a runtime size.
I don't really care what the syntax is, as long as it is relatively sane. It's fine if it requires unsafe.