On Mon, 10 Apr 2000, Ossama Othman wrote:
> Hi Kevin,
>
> On Mon, Apr 10, 2000 at 10:22:54PM -0400, Kevin Atkinson wrote:
> >
> > About a week ago I posted this massage to the libtool mailing but I have
> > yet to receive any replies.
> >
> > I could REALLY use some help here. I understand I am using a
> > developmental version and will be willing to work with you to help improve
> > libtools.
>
> I've been away for about two weeks so it would have been hard for me to
> respond. :-)
>
> > Maybe I should just not use the CXX language features and just some how
> > make sure all the right libraries get linked in and just avoid using
> > global variables which require initilization...
>
> That's one way to go, but I've run accross too many problems with the
> C support in libtool when compiling C++ shared libraries. It wasn't
> just the features you mentioned. Then again, if you only need to use
> gcc then you might be okay.
>
> I responded to your original message below.
>
> > ---------- Forwarded message ----------
> > Date: Tue, 4 Apr 2000 17:40:01 -0400 (EDT)
> > From: Kevin Atkinson <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Subject: Shared libraries w/ C++ and libltdl.
> > Resent-Date: Tue, 4 Apr 2000 17:39:36 -0400
> > Resent-From: [EMAIL PROTECTED]
> >
> > I am having all sorts of problems with shared libraries and C++ with the
> > multi-lang. branch.
> >
> > PROBLEM 1
> >
> > 1) On many platforms libtool can create shared libraries for C but not for
> > C++
>
> Right. I don't have access to all of the platforms supported by libtool's
> C library support so I wasn't able to configurations for all of the
> platforms. Any contributions would be more than welcome.
What can I do. Shouldn't it work about the same when g++ is the C++
compiler. What type of information can I send you or what can I do
without having intimate knowledge of how libtool works.
>
> > 2) On many of the platforms which libtool does know how to create C++
> > shared libraries libstdc++ is not compiled as a shared library, nor is it
> > compiled with PIC support. This means that linking the shared library
> > fails miserably because it will try to link the non PIC code into the
> > shared library.
>
> I'm a bit confused here. What does compiling libtstdc++ have to do with
> libtool? The gcc/libstdc++ distribution has its own support for compiling
> that library as a shared one.
Because libstdc++ is compiled ONLY as a static library. When I tried
creating a C++ shared library it tried to put the static library into the
shared library which failed miserably as the code does was not compiled
with PIC support. At least that is what I think happened.
>
> > So my question is
> >
> > 1) Is there a way to force libtool NOT to link it as a C++ library if it
> > can't do it as a shared library. IE don't fall back to only making a
> > static library.
>
> To my knowledge, there is currently no way to do this. IMHO, libtool
> should not do this either. It is better to add the missing C++ shared
> library configurations to ltcf-cxx.sh.
>
> > 2) Is there a way to force libtool NOT to link in libstdc++ but STILL link
> > it using c++?
>
> Try using g++'s -nostdlib flag, or one of the other related ones when
> configuring your library. If I set things up properly, libtool should
> use that flag when configuring the C++ support, and avoid linking in
> libstdc++. Note that -nostdlib will also prevent the start files from
> being linked in.
I will try that. How about a more generic solution.
>
> > In either case I would like the C++ libraries to be specified in the .la
> > files so that they will get statically linked in by libtool when a C program
> > uses my libraries.
>
> You're linking C++ libraries to a C program? That seems a bit odd. Did I
> misunderstand you?
Why? I have a library that is written in C++ but I would like C programs
to be able to use my library via extern "C" functions. What is so strange
about that?
---
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/