Don't really do much C++ (actually, only used it to help convert someone's code which originally ran on MS Windows to also work on Solaris), so that's probably why I've never had problems. Adam -- Adam Stein @ Xerox Corporation Email: adam@xxxxxxxxxxxxxxxxx Disclaimer: All views expressed here have been proved to be my own. [http://www.csh.rit.edu/~adam/] >It's really strange. For 3 last years I use 'g++ -shared' for creating shared libraries >in solaris. That's is especially important if you have templates. >------------------------------ >Lev Assinovsky >Quest Software, Inc. >O&S Core Division, Team Leader > > >-----Original Message----- >From: Adam Stein [mailto:adam@xxxxxxxxxxxxxxxxx] >Sent: Wednesday, October 20, 2004 5:00 PM >To: gcc-help@xxxxxxxxxxx; jan@xxxxxxxxxxx; Lev Assinovsky >Subject: RE: I want to build a library rather than an executable > > >I've never had any luck using gcc to create a shared library. It never seemed >to work for me (maybe I was just doing it wrong). Using ld has always worked >fine. This has always been on Solaris. I use gcc/g++ for linking a standalone >program linking to the shared library and that takes care of libstdc++ and >libgcc. > > Adam >-- >Adam Stein @ Xerox Corporation Email: adam@xxxxxxxxxxxxxxxxx > >Disclaimer: All views expressed >here have been proved to be my own. [http://www.csh.rit.edu/~adam/] > >>I don't think using ld directly is a good idea. >>In that case you should to take care about libstdc++, libgcc at least. >>------------------------------ >>Lev Assinovsky >>Quest Software, Inc. >>O&S Core Division, Team Leader >> >> >>-----Original Message----- >>From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx]On >>Behalf Of Adam Stein >>Sent: Wednesday, October 20, 2004 4:29 PM >>To: gcc-help@xxxxxxxxxxx; jan@xxxxxxxxxxx >>Subject: Re: I want to build a library rather than an executable >> >> >>>I am currently porting an existing application from Solaris 2.6 to Solaris >>>2.9 and switching to the GNU compiler 3.4.1 as well!! (previously used the >>>Sun compiler) >> >>To create a shared library, I do something like: >> >> ld -G -o mylib.so obj1.o obj2.o >> >>For a static library, I do something like: >> >> ar cr mylib.a `lorder obj1.o obj2.o | tsort` >> >>You can replace the names with variables in a Makefile as you would with >>anything else. These lines are the ones that create the final library file. >>You, of course, have to compile your C++ files into object files as normal >(i.e. >>g++ -c -o obj1.o obj1.cpp). >> >>Hope this helps. >> >> Adam Stein >>-- >>Adam Stein @ Xerox Corporation Email: adam@xxxxxxxxxxxxxxxxx >> >>Disclaimer: All views expressed >>here have been proved to be my own. [http://www.csh.rit.edu/~adam/] >> >