TCLUG Development Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG-DEVEL:124] C++/C linking problems



On Thu, Mar 02, 2000 at 03:44:11PM -0600, Scott J. Pekarek wrote:
> 
> I recognize most of the symbols as various instantiations of some of
> my template functions - and thus I know the pain is self inflicted.
> It appears some of my templates are being instantiated in my shared
> libraries and some are not.  As a note this is code (templates) that
> do compile on Digital Unix, HP-UX and Solaris - but we are using the
> proprietary compilers on those platforms (and various platform
> specific #ifdef, #pragma methodologies to go with each compiler).
> 
> I am flying by the seat of my pants on Linux here but from what I
> read I am compiling my shared libraries with "-shared -frepo".
> This looks like the "preferred" scheme with egcs-1.1.2 yes/no?

	I think it's -shared and -fPIC.

> I thought I had gone through the code and made sure that everyplace we
> had a template instantiation that the definition was there (the
> template.C file was included by the already included template.h file).
> I don't have to do anything to tell the linker to pick up all these
> *.rpo files do I?

	*.rpo?  That seems like an odd extension.  The common extension
for .o files destined to eventually be stuck into a .so library is .s.o.
And yes, you do need to do something.  You need to use gcc with the
-shared option to link all of the .s.o files into a .so file.  Then
things that want to use symbols out of the .so file, need to link it in
as a library.

Have fun (if at all possible),
-- 
Its name is Public Opinion.  It is held in reverence. It settles everything.
Some think it is the voice of God.  Loyalty to petrified opinion never yet
broke a chain or freed a human soul.     ---Mark Twain
-- Eric Hopper (hopper@omnifarious.mn.org  http://omnifarious.mn.org/~hopper) --

PGP signature