I need some help for compiling with GCC under MinGW.
Say I have 2 files: a.c contains 2 functions a1 and a2 b.c contains 2 functions b1 and b2.
Then I link the 2 objects into a shared library. The command used are like:
gcc -c a.c
gcc -c b.c
gcc -shared -Wl, --version-script v.ver -Wl, -Map=out.map -Wl, --strip-all -o mydll.dll a.o b.o
v.ver looks like:
mylib {
global: a1;
a2;
local: *;
}
which is used to control which functions to be exported.
By checking the mapfile I can see that the 2 functions in b.c are also included into the .text section of the dll.
Because this dll only exports a1 and a2, and b1 and b2 are only defined in b.c but never used anywhere. Is there any option I could add in gcc or ld so that b1 and b2 are not built into the dll so that I can save some space in the dll?
Thanks