I need to load a library dynamically at runtime, and the code doesn't have the custom types the library uses defined at compile time.
This seems to initialize the struct correctly:
void *data = malloc(128);
InitCustomType(data);
The problem with this approach is that the size of the struct is unknown.
This is an example of how the library is normally used: (CustomType is a struct)
CustomType customType;
InitCustomType(&customType);
// Now customType can be used in the library calls