I got the following error following your ld command
ld: fatal: relocations remain against allocatable but non-writable sections
I cannot specify the K parameter within the ld command
Main Topics
Browse All TopicsDevelopment environment: Solaris 9
Compiler: SUN STUDIO 12
bash-3.00$ /usr/bin/version
Machine hardware: sun4u
OS version: 5.10
Processor type: sparc
Hardware: SUNW,Sun-Fire-V210
The following components are installed on your system:
Sun Studio 12
Sun Studio 12 C Compiler
Sun Studio 12 C++ Compiler
Sun Studio 12 Tools.h++ 7.1
Sun Studio 12 C++ Standard 64-bit Class Library
Sun Studio 12 Garbage Collector
Sun Studio 12 Fortran 95
Sun Studio 12 Debugging Tools (including dbx)
Sun Studio 12 IDE
Sun Studio 12 Debugger GUI
Sun Studio 12 Performance Analyzer (including collect, ...)
Sun Studio 12 X-Designer
Sun Studio 12 VIM editor
Sun Studio 12 XEmacs editor
Sun Studio 12 Performance Library
Sun Studio 12 LockLint
Sun Studio 12 Building Software (including dmake)
Sun Studio 12 Documentation Set
Sun Studio 12 /usr symbolic links and GNOME menu item
version of "/opt/SUNWspro/bin/../prod
atch 124867-01 2007/07/12
version of "/opt/SUNWspro/bin/../prod
Patch 124863-01 2007/07/25
version of "/opt/SUNWspro/bin/../prod
OS_sparc Patch 127000-01 2007/07/18
version of "/opt/SUNWspro/bin/../prod
unOS_sparc Patch 124872-01 2007/07/12
version of "/opt/SUNWspro/bin/../prod
SunOS_sparc Patch 126995-01 2007/07/17
version of "/opt/SUNWspro/bin/../prod
7.8 SunOS_sparc Patch 126503-01 2007/07/19
--------------------------
I am current developing a shared library (libMainapi.so) which intergrating with the Cobra client service:
Source:
-Mainapi.cpp
-CobraClient_c.hh
-CobraClient_c.cc
Mainapi.cpp will include CobraClient_c.hh
I can successfully compile Mainapi.cpp and CobraClient_c.cc separately and built the Mainapi.o and CobraClient_c.o object. However I don't know how to link up them together to build the libMainapi.so library. Can anyone provide the exact command with parameter for the object linking? Thanks.
P.S. I am using VisiBroker's idl2cpp to generate the CobraClient_c.hh and CobraClient_c.cc file.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: kalamariusPosted on 2009-01-15 at 21:00:55ID: 23390369
ld -G -z text -o libMainapi.so Mainapi.o CobraClient_c.o
beware that you need to supply the "-K pic" option on the cc command line, so that both object files you created contain relocatable code.