Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does linking a static library twice result in duplication?

I have a project that links to both OpenCV and cvBlob, but cvBlob also links to OpenCV. Both OpenCV and cvBlob are built as static libraries.

Does my executable have 2 copies of all OpenCV functions that are used by both my code and by cvBlob, or does the linker detect this and remove the redundancy?

cvBlob and my code link to the same OpenCV lib files.

like image 321
sashoalm Avatar asked Oct 30 '12 15:10

sashoalm


1 Answers

If they both link to the same .lib files, then there is only one copy in the final executable.

like image 111
cbranch Avatar answered Oct 12 '22 14:10

cbranch