🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.unix.programmer
3 messages
3 total messages Started by Brian Reynolds Wed, 23 Dec 1998 00:00
Re: CC compiled .so does not work with g++ compiled main program
#3396
Author: Brian Reynolds
Date: Wed, 23 Dec 1998 00:00
47 lines
1922 bytes
I am trying to develop a shared library (.so) on Solaris to extend a

program, but it will not load. 



We have boiled down the problem to an incompatability between the g++

and CC compilers. The main program is a C++ program compiled with g++.

For certain reasons, I need to compile my shared library with CC though.

If I do compile the library with g++ (compile ".o"s using -g and -fPIC

options, and linking with -shared option) it works, but if change to

Sun's CC compiler and compiler (compile ".o"s with -g and -PIC, link

with -G option) the module can no longer load; that is, the main program

can not call any of the functions in the library.



Something that makes this problem a bit easier is that the functions in

the library that must be called by the main program are c functions that

in turn call c++ functions. This at least keeps me from having to deal

with the name mangling problems that I know are an incompatability

between the two compilers. 



Does anyone have information on what I would need to do to get a c++

library compiled with CC to be loaded from a main program compiled with

g++? 



Brian

brian.reynolds@iai.com
Re: CC compiled .so does not work with g++ compiled main program
#3397
Author: James Hawtin
Date: Sun, 03 Jan 1999 00:00
8 lines
1056 bytes
Have you checked your LD_LIBRARY_PATH so that your .so is in it, or link
with LD_RUN_PATH with the correct search path.

James
-- 
No dinosaurs please we're goffik! Goff type 1/1/2/4/9 FogeyGoff

Lifes a Joke and Deaths the End, Live in Misery - Net.Goth
Re: CC compiled .so does not work with g++ compiled main program
#3398
Author: Pim van Riezen
Date: Sat, 09 Jan 1999 00:00
23 lines
1681 bytes
James Hawtin wrote:
> 
> Have you checked your LD_LIBRARY_PATH so that your .so is in it, or link
> with LD_RUN_PATH with the correct search path.
> 
> James

Those environment vars don't change when you choose a different
compiler. The problem is in the way that some native CCs turn c++
functions/methods into symbols (remember that in c++ symbols returntype
and argument types are also kept to allow for overloading). I've had a
lot of problems with that on IRIX too (and haven't found a solution for
it yet).

Cheers,

Pi

-- 
             "Time is an illusion. Lunchtime doubly so."
 Patron Saint of Breakfast Cereal, Occultist (not precluding rogue
obscenities such as IRIX and C++), Casual Poet, Occasional Composer,
    Oper Bastard for Undernet.Org, Freelance LART for #linux
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads