Re: dynamic static linking library --

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



thanks a lot to all of you ...
Nidhi

On Tue, Dec 16, 2008 at 12:44 PM, Rajath N R <rajathnr@xxxxxxxxx> wrote:
Hi,

i have a doubt regarding linking of libraries in c program
lets say i have a hello.c C program and hello is executable file correspoding to this.

i read that if libraries are linked dynamically then size of executable file hello is smaller as compared to the size of executable if libararies are linked statically .
it wd be kind if you accept this ques and answer it
hi all i know its not directly related to kernel ...but its the doubt i got while kernel programming only ..its in c langugage
      Yeah your right. static libraries linked at compile-time and external functions and variables which are resolved at compile-time. where as dynamic libraries are loaded at run-time with dlopen() system call.
   dlopen()  :
subroutine is used to open a shared object, and dynamically map it into the running programs address space.
   dlsym()   : routine to search for symbols in the loaded shared object.
dlclose() : subroutine is used to remove access to a shared object that was loaded into the processes' address space
                with the dlopen subroutine.
 

in my opinion that means that in case of dynamic linked library hello does not contain libraries with it it is just linked with them.
may be hello contain references to symbols ...where they are present in linked libraries.
  dlsym() obtain the address of a symbol defined in dynamic library .
 

now suppose i transfer this hello file to some other machine but same platform which doesnt contain these libraries ....will it work there ?
i hope it shd not
    No it will not work. dlopen will fail.

but i have heard ppl say that executable file is complete in itself and it works taken anywhere on same platform.

pl clarify ..
where i m wrong i know there is some fault in my understanding of linking concept but unable to clarify it from google...
--
Thanks & Regards
Nidhi

C Language technical discussion & FAQ

Group Email Addresses

Post message: c-forum@xxxxxxxxxxxxxxxxx
Subscribe: c-forum-subscribe@xxxxxxxxxxxxxxxxx
Unsubscribe: c-forum-unsubscribe@xxxxxxxxxxxxxxxxx



--
Thanks & Regards,
Rajath N R



--
Thanks & Regards
Nidhi

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux