Thread: does anybody know if it is possible to use C++ libraries in C programs....

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    3

    does anybody know if it is possible to use C++ libraries in C programs....

    ....????

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Libraries? Like what? Some are native to C (they work with both) and some are native to C++.

  3. #3
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    C programs can call library functions created with a C++ compiler if the function name isn't mangled. In C++, you can use the command:
    Code:
    extern "C" {...}
    To keep the compiler from decorating the function name.

  4. #4
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    Quote Originally Posted by bithub
    C programs can call library functions created with a C++ compiler if the function name isn't mangled. In C++, you can use the command:
    Code:
    extern "C" {...}
    To keep the compiler from decorating the function name.

    what do u mean "mangled" up.

    do u know any good sites where u can get extra libraries to extend c????

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    What kind of libraries are you looking for?

  6. #6
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    what do u mean "mangled" up.
    C++ mangles function names to allow for things like overloading. For instance, then function
    int test(char*,int)
    will get mangled to:
    ?test@@YAHPADH@Z

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Apr 2005
    Posts
    3
    thanks for the link

    does anybody know any other links for c other additional libraries, preferably for working with windows

  9. #9
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    That question is far too generic to answer. What do you need a library for?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 07-27-2008, 08:25 AM
  2. Replies: 7
    Last Post: 05-13-2008, 03:47 AM
  3. MinGW thread-safe runtime libraries
    By Mario F. in forum C++ Programming
    Replies: 3
    Last Post: 08-21-2006, 08:15 AM
  4. Libraries and headers
    By darksaidin in forum C++ Programming
    Replies: 10
    Last Post: 07-23-2003, 06:24 AM
  5. POSIX/DOS programs?
    By nickname_changed in forum C++ Programming
    Replies: 1
    Last Post: 02-28-2003, 05:42 AM