[LLVMdev] C++ to C

John T. Criswell criswell at cs.uiuc.edu
Thu Nov 16 20:59:12 PST 2006


Mohd-Hanafiah Abdullah wrote:

>After converting a piece of C++ code to C one of the functions that are
>generated is this:
>_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
>  
>
This is a method/function from the standard C++ library.  You can link 
it in at the bytecode level with:

llvm-g++ -o output.bc <yourfile.bc> -lstdc++

You might also be able to do:

llvm-g++ -o output.bc <yourfile.bc> -lsupc++

... if you're only doing minimal C++ work.

One caveat: you will still have references to external C library 
functions (fopen(), open(), etc) that will not exist in the C output 
from the llc command.  Can your C to Java Bytecode compiler handle calls 
to these functions?

-- John T.

>Where is it defined and where can I find the source for it?  I need the
>source to compile it with a C compiler (AMPC) that will convert the C
>code to Java Bytecode.  If the above function is in C++ then I need to
>convert it to C first.
>
>Here's the code segment that uses the function:
>
>int main(void) {
>  struct
>l_struct_2E_std_3A__3A_basic_ostream_3C_char_2C_std_3A__3A_char_traits_
>3C_char_3E__20__3E_ *ltmp_2_2;
>
>  CODE_FOR_MAIN();
>   /*tail*/ __main();
>  ltmp_2_2 =  /*tail*/
>_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc((
>&_ZSt4cout), (&(_2E_str_1[0])));
>  return 0;
>}
>
>Thanks for any tips.
>
>Napi
>
>_______________________________________________
>LLVM Developers mailing list
>LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>  
>




More information about the llvm-dev mailing list