Question: There is a dynamic library, whose exposed structure is being changed, new fields are being added at the end of the structure.

Memory for the structure is allocated from within the library and application doesn't allocate it.But, the application may be accessing members of the structure directly.

In this case is it required for the application to recompile again with the library?

Library is being used on all Operating Systems (Windows, Linux, Solaris, HP-UX etc).

Answer: 
Some libraries such as FFmpeg do something like this. FFmpeg has a `struct AVFrame` whose `sizeof` must not be used by applications, as new fields may be added with only a minor version bump. The library provides functions to allocate `struct AVFrame`; these functions not allow allocating arrays of them. Care must be taken to avoid using an older minor version than the application was linked to; not all shared library mechanisms support minor versions.

I think this is a bit ugly, but if applications do not do the disallowed things it should be OK. A cleaner method is to keep the layout of structs that need to be extended private.
If the structure's size doesn't change, recompiling the code is not needed. That's why you often see structs like this in public APIs:

```
struct something {
  int public_field1;
  float public_field2;
  char padding[256];
}

```

When new fields are added, they are added after `public_field2`, and the size of the padding is decreased so that the total size remains constant.