I'm still struggling to understand the core difference between dynamic linking and static linking, below is a picture and sample code from my textbook:
/* main2.c */
#include <stdio.h>
#include "vector.h"
int x[2] = {1, 2};
int y[2] = {3, 4};
int z[2];
int main()
{
addvec(x, y, z, 2);
printf("z = [%d %d]\n", z[0], z[1]);
return 0;
}
and libvector.so just a DLL that provides definition needed by main2.c
So my questions are:
Why p2 is a 'partially linked executable object file'? Since it is called 'partially linked', so it must have done some static linking. But since none of the code or data sections from libvector.so or libc.so are actually copied into the executable p2 at this point. So why p2 is still 'partially linked'? Isn't the static linking is about copying code and data sections from objects files, if there is no copy, then there is no static linking involved?
