This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C++ - Why always libm?
- To: Per Bothner <bothner at cygnus dot com>
- Subject: Re: C++ - Why always libm?
- From: "B. James Phillippe" <bryan at terran dot org>
- Date: Mon, 8 Jun 1998 14:45:50 -0700 (PDT)
- cc: egcs Mailing List <egcs at cygnus dot com>
- Organization: Terran.ORG/LinuxWorld.NET
On Mon, 8 Jun 1998, Per Bothner wrote:
> > Let me ask this again: Can anyone explain why libm is linked with even the
> > simplest C++ program?
>
> It is an accident of history that libm is (sometimes) separate from libc.
> ANSI/ISO C and C+ do not mention either, or divide them into separate
> libraries.
Thank you, that was a good explanation. I understand now why libm is
linked as well.
> In that case, perhaps you should invoke the linker by hand. Or at
> least use the -nostdlib flag to explicitly select libraries.
I might try this. It isn't so much "mission critical" that I need to
change anything; I just wanted to understand what was happening.
> Shared libraries were not designed for "embedded applications".
>
> I suggest linking all your programs together as one large statically-linked
> appliction. Use threads if you want multiple "applications". That is
> what embedded systems people normally do.
Actually, this is something I've asked for in the past (threads
specifically). However, I'm part of a larger development project and don't
think changes like that will happen any time soon. This is all baggage
we're carrying from several years ago before libpthreads was working with
libc safely. I do appreciate your informative response, thanks.
-bp
--
B. James Phillippe <bryan@terran.org>
Linux Software Engineer, WGT Inc.
http://earth.terran.org/~bryan