[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking in C++ mode
From: |
Pierre Sarrazin |
Subject: |
Re: Linking in C++ mode |
Date: |
Sun, 10 Nov 2002 17:42:30 -0500 |
User-agent: |
Mutt/1.2.5.1i |
Dixit John Levon <levon at movementarian.org> (2002-11-10 15:31):
> > A proper solution would be to use g++ to link the application. To
> > achieve this with automake, the easiest way is to convert the
> > main-application file to c++. In your case, renaming oprofiled.c to
> > oprofiled.cc would be sufficient.
>
> This seems IMHO to be a terrible hack. I've found automake to be quite
> flexible so far; am I hitting one of its limitations ?
Another way to force automake to use g++ to link the application
seems to be to leave the .c alone, but to add a dummy.cc file to
the application's _SOURCES variable. The .c file is still compiled
by gcc.
dummy.cc can be something like 'static void dummy();'. It can be
created automatically like this:
prog_SOURCES = prog.c dummy.cc
dummy.cc:
echo 'static void dummy();' > $@
I'd be curious to know if there are significant drawbacks to this hack.
One thing is certain, the way to test any solution is to make sure
that global variables in the C++ library are constructed before
main() starts.
--
Pierre Sarrazin <sarrazip at sympatico dot ca>
- Linking in C++ mode, John Levon, 2002/11/09
- Re: Linking in C++ mode, Earnie Boyd, 2002/11/10
- Re: Linking in C++ mode, Ralf Corsepius, 2002/11/10
- Re: Linking in C++ mode, John Levon, 2002/11/10
- Re: Linking in C++ mode,
Pierre Sarrazin <=
- Re: Linking in C++ mode, John Levon, 2002/11/10
- Re: Linking in C++ mode, Pierre Sarrazin, 2002/11/10
- Re: Linking in C++ mode, John Levon, 2002/11/10
- Re: Linking in C++ mode, Pierre Sarrazin, 2002/11/10
- Re: Linking in C++ mode, Earnie Boyd, 2002/11/10
- Re: Linking in C++ mode, John Levon, 2002/11/10
- Re: Linking in C++ mode, Ralf Corsepius, 2002/11/10
- Re: Linking in C++ mode, Ralf Corsepius, 2002/11/10
- Re: Linking in C++ mode, John Levon, 2002/11/11
- Re: Linking in C++ mode, Alexandre Duret-Lutz, 2002/11/14