[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: c++ without libstdc++
From: |
Robert Heller |
Subject: |
Re: c++ without libstdc++ |
Date: |
Thu, 26 May 2005 00:15:59 +0200 |
Maurice <mauricex@gmx.net>,
In a message on Wed, 25 May 2005 23:59:35 +0200, wrote :
M> Hello,
M>
M> for an embedded system I would like to write in C++ using
M> gcc 2.95 but without linking to libstdc++ (its too big).
M> I wonder how far this is possible:
M>
M> struct Foo {
M> Foo(){}
M> ~Foo(){}
M> };
M> int main() { Foo a; }
M>
M> $ g++ -nodefaultlibs -fno-exceptions -lc a.cc
M>
M> In function `Foo::~Foo(void)':
M> ... undefined reference to `__builtin_delete'
M>
M> Without this destructor there is no problem. But C++ without
M> using destructors... thats not funny either.
M>
M> Is there anything I can do?
You are going to need *some flavor* of libstdc++ and libgcc.
Fortunately, you have the sources to both available. What you need to
do is build a restricted version of these libraries, tailored to your
embedded system. Your restricted version of these libraries will
include necessary pieces like __builtin_delete (which you need), but
not include all of the other pieces you don't need or want. You will
end up with *small* versions of libstdc++ and libgcc. You may also need
a specially crafted set of header files too. Basically, you are
building a cross-build system for a new target (your embedded system).
M> Thank you.
M>
\/
Robert Heller ||InterNet: heller@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || heller@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153