Mail Archives: djgpp/2000/09/30/10:02:38
> From: "Salvador I. Ducros" <sducros AT home DOT com>
> Newsgroups: comp.os.msdos.djgpp
> Date: Sat, 30 Sep 2000 01:49:14 GMT
>
> My question is basically whether or not the linker (let's say
> the DJGPP linker specifically) will include a function from a static
> library into an executable if:
>
> 1. the address of the function is assigned to some function pointer
> 2. the function pointer is never actually derefernced
> 3. the function is never called by name
Yes, the linker will link the function into your program. The reason
is that the moment you assign the address of the function (using its
name) to a pointer, the linker sees a name of an external symbol that
it needs to resolve at link time.
> ds->fn1 = A;
> ds->fn2 = B;
> ds->fn3 = C;
This is the point where the linker will know it needs to resolve
functions (actually, symbols) A, B, and C.
- Raw text -