Thread: Calling C++ routines from C?

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    1

    Question Calling C++ routines from C?

    Guys,
    Please can anyone help me? I want to call C++ routines from my C code. 1: is this possible and 2: can anyone tell me how I can do it? I guess I'd need to call some kind of C++ wrapper for my C++ routines?

    Many thanks

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    In simple cases, C and C++ use the same calling conventions. If the C++ has been compiled with a suitable compiler, the object should be callable from C. Where you may have some problems is if the C++ code uses some C++ specific features, function overloading for example, here the name of the C++ function becomes "decorated" to enable the C++ environment to resolve any ambiguity. "Decoration, (mangling), is not standard and hence will vary from compiler to compiler.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stack issues when calling a COM library
    By notnot in forum C Programming
    Replies: 3
    Last Post: 06-01-2009, 02:12 AM
  2. calling functions within functions
    By edd1986 in forum C Programming
    Replies: 3
    Last Post: 03-29-2005, 03:35 AM
  3. calling default instead of argument constructor, why?!
    By cppn00b in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2005, 04:24 AM
  4. Special Allegro Information
    By TechWins in forum Game Programming
    Replies: 12
    Last Post: 08-20-2002, 11:35 PM
  5. rom/bios routines
    By ALLRIGHT in forum C Programming
    Replies: 1
    Last Post: 05-12-2002, 11:38 AM