[LLVMdev] Convert C++ to C. What is 0x0p+0 ?

Mohd-Hanafiah Abdullah napi at axiomsol.com
Sun Nov 5 22:22:28 PST 2006


Hi Reid:

I hate to be a pain.  But when I ran the program helloworld.class
after compiling it with AMPC I got the following message:

Exception in thread "main" java.lang.NoClassDefFoundError:
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
        at helloworld._Z4CONTv(Unknown Source)
        at helloworld.__main(Unknown Source)
        at helloworld._$C_main(Unknown Source)
        at helloworld._$pre_C_main(Unknown Source)
        at helloworld.main(Unknown Source)

The function _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc()
was generated by llc after translating it from the C++ statement
std::cout.

How do you suggest I handle this sort of things properly?
The appropriate files are attached.

Thanks.

Napi


On Sun, 2006-11-05 at 20:16 -0800, Reid Spencer wrote:
> Hi Napi,
> 
> On Mon, 2006-11-06 at 12:17 +0800, Mohd-Hanafiah Abdullah wrote:
> > On Sun, 2006-11-05 at 19:06 -0800, Reid Spencer wrote:
> > ...
> > > As for the __main function, its a gcc library call required by the
> > > compiler for program startup.  The details vary but the call is needed.
> > > Amongst other things it will probably initialize your C++ static
> > > constructors. 
> > 
> > Hi Reid:
> > 
> > I'm not using gcc for this purpose but another C compiler called AMPC.
> > It compiles C code into Java Bytecode.  What I'm missing is the C++ to
> > JVM portion which I'm trying to use LLVM for converting C++ to C then
> > pass it through AMPC to get the Java Bytecode.
> 
> Okay, cool :)
> 
> > One question is does the resulting C code produced by llc will call C++
> > functions/methods still? 
> 
> Yes.
> 
> >  It would be good if only C library functions
> > are called since I already have the standard C library compiled by AMPC
> > in the bytecode format.
> 
> If you use the stdc++ library in your source code then you'll need to
> compile that with AMPC as well (after siphoning it through llvm).
> 
> > 
> > Thanks.
> 
> You're welcome.
> 
> Reid.
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: helloworld.c
Type: text/x-csrc
Size: 8662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061106/6aac3698/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: helloworld.cpp
Type: text/x-c++src
Size: 95 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20061106/6aac3698/attachment.cpp>


More information about the llvm-dev mailing list