I apologize ahead of time if my terminology is incorrect.
Let's say I have a shared library called libVectorMath.so
. In it are two interesting functions, addVector()
and subtractVector()
. The two functions are prototyped in vectorMath.h
. I also have an executable called testVectorMath
, which uses those two functions, and is dynamically linked to libVectorMath.so
.
Generally speaking, to build testVectorMath
, I need to build libVectorMath.so
as well. Why is this? Is the header file vectorMath.h
not sufficient to tell testVectorMath
what symbols it should expect to find in libVectorMath.so
?
In other words, can't testVectorMath
have some instructions in it to say "look for a library called libVectorMath.so
and then look for symbols named addVector()
and subtractVector()
within it"?