This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs & Dynamic Libraries




Richard Henderson wrote:

> > 3°/ How can I write the compilation command to produce the desired
> > executable.
>
> Um, like using any other library?  What are you asking?
>
> r~

Sorry, Let's see at a complete example:

I define a *great* class: A.
A::A()
{
    cout << "A::A()" << endl ;
}

>g++ -c -g -fpic A.cpp
>g++ -g -shared -o A.so A.o   (2)

An *amazing* main.
int main ()
{ A  a ;}

>g++ -c -g -fpic main.cpp
>g++ -g -o main main.o A.so (4)

I set LD_LIBRARY_PATH, to use the current dir.
And... all works fine !

>./main
A

Althrough the things are alrights, maybe I've miss some compiler options !

Should I add the -fpic flag at the (2) & (4) compilation lines ?
It works whether I set it or not.

--
Jean-Michel Paris - Software Engineer
SITA Group http://www.sita.int
Internetworking Products & Services Program
Bât Héraklion - 1041 Route des Dolines
Sophia Antipolis
06560 VALBONNE - FRANCE
mailto:Jean-Michel.Paris@pt.nce.sita.int
http://www.mygale.org/07/jmparis (Most Recent Update: 13 August 1998)




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]