[LLVMdev] question on difference of bitcode between C and C++

Bill Wendling wendling at apple.com
Wed Sep 21 18:26:52 PDT 2011


On Sep 21, 2011, at 6:13 PM, Fei Jia wrote:

> Could anybody provide me some links or pages or infos of the difference of bitcodes of C and C++? We have implemented an optimization pass on bitcode generated from C, and we are trying to find out whether it will work on bitcode from C++. Thanks!
> 
Hi Fei,

There isn't a difference in the bitcode format of a C as opposed to a C++ program. There are differences in how functions are linked, but that's a function of the language and not the bitcode. E.g., if you want to call a C function from C++, you need to do this:

extern "C" {
  void foo();
}

void bar() {
  foo();
}

-bw





More information about the llvm-dev mailing list