Re: link question

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

 



On 6/29/2011 11:46 AM, Mulyadi Santosa wrote:
> Hi...
>
> On Thu, Jun 30, 2011 at 00:36, Littlefield, Tyler<tyler@xxxxxxxxxxxxx>  wrote:
>> I have a quick question; this is something I haven't been able to figure
>> out. By using the kernel headers you can call functions that are defined
>> in the kernel, but you don't actually have to link to the kernel or any
>> sort of library. How does this work? How does compiled code call the
>> function if it doesn't link to it in some way or another?.
> you need to look closer....for example include/linux/mm.h. There you
> will see definition of constants and functions used for memory
> management.
> Sure, the constants and functions are there. Some are externs, some are defined within the header itself, and some are prototypes. Now, in most applications
> when I want to use another API I include that header and link to the library. This tells the linker that it can pull the functions from that library that
> I use, and that were defined in the header and include them in the binary.
>
> So, what library here means IMHO are group of headers that contains
> the needed functions/definitions by themselves. Linking? I think it's
> better named as "including"...indeed there are linking process during
> kernel build, but that is just a way to build final image using
> several objects which originated from the practice of refactoring etc.
>
Library means... Library here. There is a difference between a library 
and a header. If you have the prototypes defined in a header the 
compiler knows that
you are going to call those functions (or that you can rather), but how 
does it know where the function is? How does the linker import the mm 
functions
for example if you only include a header?

> kindly CMIIW people...
>


-- 

Take care,
Ty
my website:
http://tds-solutions.net
my blog:
http://tds-solutions.net/blog
skype: st8amnd127
My programs don't have bugs; they're randomly added features!


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[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