Library

This is a discussion on Library within the C Programming forums, part of the General Programming Boards category; When i look up at the functions which are defined in stdlib.h, they only show something like this Code: #ifndef ...

  1. #1
    1337
    Join Date
    Jul 2008
    Posts
    135

    Library

    When i look up at the functions which are defined in stdlib.h, they only show something like this
    Code:
    #ifndef __CYGWIN__
    _PTR	_EXFUN(_malloc_r,(struct _reent *, size_t));
    _PTR	_EXFUN(_calloc_r,(struct _reent *, size_t, size_t));
    _VOID	_EXFUN(_free_r,(struct _reent *, _PTR));
    _PTR	_EXFUN(_realloc_r,(struct _reent *, _PTR, size_t));
    _VOID	_EXFUN(_mstats_r,(struct _reent *, char *));
    #endif
    int	_EXFUN(_system_r,(struct _reent *, const char *));
    
    _VOID	_EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *));
    
    _END_STD_C
    
    #endif /* _STDLIB_H_ */
    Let say if i want to view the code of the strcmp() function, where can i find it?

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Depends on if you've got an open source library. If so, then the library documentation will tell you. If you're looking for say Microsoft's version, you're not going to find it.

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    That's right - the header files only contain the information necessary to check that your code uses the function prototypes correctly. Header files in turn are linked to code, which in the case of standard C, is almost always a precompiled library. Most Linux systems use glibc, and you can download the source code at Index of /gnu/glibc. As for windows systems, I'm not sure what the library is called or if you can even get a copy of it. There are other alternatives out there used by some systems. In any case - the implementations won't differ THAT much. They have different optimizations, etc... but if you just want to see how an operation can be done, glibc is a decent example.

  4. #4
    1337
    Join Date
    Jul 2008
    Posts
    135
    Thanks. And what does MSDN do and have? I mean the library.
    Take this as an example

  5. #5
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Microsoft is usually pretty good about giving lots of details to developers. You'll find plenty of good references through MSDN, and they should give you any relevant implementation details. But they're closed-source, and you probably won't find any source code there, other than examples.

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,265
    Quote Originally Posted by valthyx View Post
    Thanks. And what does MSDN do and have? I mean the library.
    Take this as an example
    Chances are that if it comes from Microsoft, the source code is not available.
    bit∙hub [bit-huhb] n. A source and destination for information.

  7. #7
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    23,031
    Quote Originally Posted by tabstop View Post
    Depends on if you've got an open source library. If so, then the library documentation will tell you. If you're looking for say Microsoft's version, you're not going to find it.
    Of course you are. Microsoft provides the full source code of its C and C++ libraries. They reside on the hard drive under the Visual Studio directory somewhere. Don't know where exactly.
    You can also step into those functions to see the source.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's an import library?
    By chiefmonkey in forum C++ Programming
    Replies: 1
    Last Post: 06-19-2009, 06:00 PM
  2. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 07:04 AM
  3. Makefile for a library
    By sirmoreno in forum Linux Programming
    Replies: 5
    Last Post: 06-04-2006, 05:52 AM
  4. very weird .h problem
    By royuco77 in forum C++ Programming
    Replies: 1
    Last Post: 09-11-2005, 08:55 AM
  5. better c string functions
    By samps005 in forum C Programming
    Replies: 8
    Last Post: 11-04-2003, 01:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21