Should the library be updated when the .h file is updated?

I've already sent our library ( .a

, .so

) to our client along with the .h

files.

Now I have few changes to the file .h

. So my question is: do I need to send updated .a

, .so

or send .h

.

The client would replace the files .h

with the old one .h

.

Will this work?

+3


source to share


4 answers


It depends on what you updated in the .h file.

If you've updated something that doesn't require recompilation (like some comments?), You can just provide the updated .h file.



But, in general, I believe that for safety, if you change the header, it is good practice to recompile the entire module (so that you can re-send the object and library binaries to your clients).

+1


source


It is absolutely necessary to redistribute if you have moved a member function declaration.

This is because any v-table will be invalidated.



The attachment will also change the linking behavior: the old library will export a decorated non-inline function that is incompatible with the behavior specified in the new version of your header.

+1


source


Yes, you should update .h with .a / .so. For example. you changed the data structure to be larger / smaller. You can get a heap collapse error on a simple header update.

0


source


One question you ask yourself is, "What would the scons do?"

I have several projects that use scons as a build tool. I noticed when I change the header file that scons always compiles the affected modules, but sometimes does not feel the need to rebuild the libraries or executables they are a part of.

In general, it's good practice to recompile everything before releasing it to the client, but if you find that it doesn't need to be rebuilt, then you shouldn't actually release anything.

0


source







All Articles