COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### Bizarre link/dlclose() error on Solaris

• Email
• Follow

I'm witnessing bizarre behaviour with my dynamic C++ libraries on Solaris.
Thought I'd ask here, because y'all managed to solve the first half of my
problem };*)

Originally I was using "ld" to link my libraries, which worked fine except
that it failed to catch exceptions thrown by main-app functions called from
the libraries. I was advised to use g++ to link my libraries, since that's
what I was using to link the main application.

Success! All of the exceptions were now caught correctly.

BUT - Failure!

Previously, when the libraries were linked using ld, I could quite happily
overwrite the .so files with a new library; I coded the main app to detect
that, dlclose() the current version of the library and dlopen() the new
version, and carry on.

This is now broken. If I persuade the main app to reload the library
(without changing it), it works fine. If I change the .so file on disk and
then try the reload process, my application crashes (sometimes SEGV,
sometimes Illegal Instruction) in dlclose()

Any ideas what's going on? It's almost as if dlclose() is referring back to
the .so on disk to find out how to shut the library down, and tripping over
the fact that the code offsets are now different. But I can't understand why
that wasn't happening before with ld.

I haven't changed any other compiler or linker options, just literally
swapped "ld" for "g++". I'm using RTLD_NOW in dlopen (i.e. I'm not using the
GLOBAL or NODELETE parameters)

Any thoughts appreciated,

Paul

{company disclaimer snipped -mod}

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated.    First time posters: Do this! ]

 0

See related articles to this posting

Paul Harman wrote:
> I'm witnessing bizarre behaviour with my dynamic C++ libraries on Solaris.
> Thought I'd ask here, because y'all managed to solve the first half of my
> problem };*)
<snip>
> Previously, when the libraries were linked using ld, I could quite happily
> overwrite the .so files with a new library; I coded the main app to detect
> that, dlclose() the current version of the library and dlopen() the new
> version, and carry on.
>
> This is now broken. If I persuade the main app to reload the library
> (without changing it), it works fine. If I change the .so file on disk and
> then try the reload process, my application crashes (sometimes SEGV,
> sometimes Illegal Instruction) in dlclose()
>
> Any ideas what's going on?

There might be a bug in the destructor for a static object, that you
are coincidentally provoking.

> It's almost as if dlclose() is referring back to
> the .so on disk to find out how to shut the library down, and tripping over
> the fact that the code offsets are now different. But I can't understand why
> that wasn't happening before with ld.
<snip>

Unix marks executable files, including shared libraries, as "busy" or
read-only so long as they are loaded into a process.  Presumably when
you rebuild the shared library it is unlinked rather than overwritten,
meaning that the old version remains on disk until it is unloaded.
If the finalisation code for the shared library needs to be paged in
when it is closed, it will be paged in from the old version and not
the new version.

However, if there is something wrong with the "busy" mechanism then

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated.    First time posters: Do this! ]

 0

1 Replies
296 Views

Similar Articles

12/11/2013 5:20:33 AM
page loaded in 91673 ms. (0)

Similar Artilces:

Gcc On Solaris Sparc Versus Solaris Intel: Repost With Error Information Included
Gentle People? I am currently running gcc 3.1 on both my Ultra 5 Solaris 8 Sparc machine and on Solaris 8 Intel machine. The C source code that compiles and executes perfectly on the Ultra 5 will not compile on the Intel machine! The compilation errors, shown below, seem to relate to syntax errors, and not simply missing files. Remember this same code compiles perfectly on the Sparc machine. There is no inline assembly language or obvious machine dependent code involved. Why would there be such a difference in the between gcc on Sparc versus Intel? Someone mentioned that...

hi, i have written a function in adding a node to the linked list but this only adds "1" to the list as i get in the output I'm using borland c++ compiler The code ------------------------------------------------------------- #include <alloc.h> #include <stdio.h> #include <string.h> void append(struct node **, int ); void display(struct node *); struct node { int data; struct node *link; }; void main() { struct node *p; p = NULL; //printf("the number of elements in the linked list are: = %d", count(p)); append(&p, 1); append(&p, 5); ...

I am trying to write a C++ program that uses Entrust encryption. Entrust supplies header files and *.so files that (apparently) are created using Sun's C++ compiler. My office doesn't want to spend any money on this, so I'm using g++. The compile phase goes fine, but I wind up with "undefined symbol" entries in the link step. Running the nm utility to see what the symbols in the object module and the *.so files are, I come up with things like this: _Z14EntLogToStrings in the object and __1cOEntLogToString6Fh_pkc_ in the *.so _ZN7EntFile19GetConstructorErrorEv (object) _...

what is the solaris equivalent for the following linux command find . -follow -xtype l ------------------------------------------------------------------------- My requirement is to Display All symbolic links (not directories, not files) in a folder. This folder has symbolic links to folder which again have symbolic links. I want to list this multilevel symbolic links also. In linux i can use >>>>>>>>>> find . -follow -xtype l for the same... In solaris ... Can we use "-follow" with "-type l"??? I saw in the man pages that when you use ...

SAR error on Solaris 9
I am getting the following error when running sar: sar: data file not in sar format Also, every Solaris system I have worked on before had the 'top' command. The system we have at my current job doesn't seem to have it. Isn't this an inherent command for Solaris? Buckwheat wrote: > I am getting the following error when running sar: > > sar: data file not in sar format The sar data probably hasn't been initialized. Look in /etc/rc2.d/S21perf. Also check out sys' crontab. > Also, every Solaris system I have worked on before had the 'top' comma...

Hello, I have a simple program to create strings from the corresponding double/integer values. For any data type similar to int, I have a template set up in a file misc.h: ************************************************************************************* //misc.h #ifndef __MISC_H__ #define __MISC_H__ #include <string> //!Convert any numerical quantity (int, long, uint*_t, time_t, etc) to a string template <class X> string numtostr(X number); //I have explicitly overloaded it for double: //!Convert a double to a string string numtostr(double number); #endif I have th...

Error during Solaris 10 install
When doing a full (OEM) install of Solaris 10 on a 280R, at the very end just before rebooting I get the following error: Pausing for 90 seconds at the "Reboot" screen. The wizard will continue to the next step unless you select "Pause". Enter 'p' to pause. Enter 'c' to continue. [c] /usr/sbin/pmconfig: cannot open "/dev/pm": No such file or directory Feb 23 14:34:28 dev-node1 reboot: rebooted by root Feb 23 14:34:28 dev-node1 syslogd: going down on signal 15 syncing file systems... done rebooting... Resetting ... Just wondering if th...

CAPTURE_UPTIME ERROR in Solaris 10
I am seeing the following error in /var/adm/messages after a fresh install of Solaris 10. I selected full install [ID 702911 daemon.error] CAPTURE_UPTIME ERROR: /var/opt/SUNWsrsrp missing Any clues? Thanks in advance "madhu" <eloormadhu@hotmail.com> writes: > I am seeing the following error in /var/adm/messages after a fresh > install of Solaris 10. I selected full install > > [ID 702911 daemon.error] CAPTURE_UPTIME ERROR: /var/opt/SUNWsrsrp > missing > > Any clues? Thanks in advance That's coming from SRS Netconnect ... it sounds like the inst...

Hi, I am trying to implement STL list on VxWorks 5.4 using ccppc The code written so far is ----header file #define __DECLARE_GLOBALS_HERE #define __PUT_STATIC_DATA_MEMBERS_HERE #include <list> -----cpp file template class list<int>; The file compiles fine but throws the following error while linking /vobs/optera/target/lib/libPPCEC603gnuvx.a symTbl.o ctdt.o /vobs/optera/target/lib/libOPTERA_5200_SP2_REL.a(cfgMac.o): In function list<int, __default_alloc_template<true, 0> >::operator= (list<int, __default_alloc_template<true, 0> > const &)':...

error booting solaris 10
Hello experts, I have installed solaris 10 on x86. When I try to boot I get an error with ablue screen login failed please try again. I am new to this o.s. It used to work nicely before what did I do wrong? Any guidance advice will be highly appreciated Thanks, Dave On Tue, 20 Dec 2005, drbrahmbhatt@yahoo.com wrote: > I have installed solaris 10 on x86. When I try to boot I get an error > with ablue screen > login failed please try again. I am new to this o.s. It used to work > nicely before what did I do wrong? So it's booting to the login screen, but when you enter a use...

I am running Miktex pdflatex with hyperref and am getting some incorrect hyperlinks in the index: the reference to Page n points to the nth page rather than the page numbered n for some of the links to pages 1-6. I have six pages of frontmatter (numbered i-vi) followed by pages 1,2, ... . The key document setup is shown below: \documentclass[letterpaper,twoside,12pt]{article} \usepackage{amsmath,amssymb} \usepackage{graphicx} \usepackage{makeidx} \usepackage[letterpaper,pdfpagelabels]{hyperref} \usepackage[all]{hypcap} \begin{document} : My Miktex version is up-to-date. Can anyone see what I ...

solaris build error ... help needed
gcc -c -O3 -Wall -KPIC -UVE_DUMP_X86 -I../include -I../../om/ include -I../../pi/include -I../../parser/include -I../../superlog/ include cheetah_rusage.cxx -o ../../../obj/sun7-gcc2.95.2-32/ cheetah_rusage.o gcc: unrecognized option -KPIC' ld -r -o ../../../obj/sun7-gcc2.95.2-32/utils.o ../../../obj/sun7- gcc2.95.2-32/cheetah_dump.o ../../../obj/sun7-gcc2.95.2-32/ cheetah_restore.o ../../../obj/sun7-gcc2.95.2-32/ dumpRoutines.o ../../../obj/sun7-gcc2.95.2-32/cheetah_rusage.o ld: elf error: file ../../../obj/sun7-gcc2.95.2-32/cheetah_dump.o: elf_strptr: Request error: no string tabl...

Solaris 10 X86 Desktop errors
I have solaris 10 installed on x86 box. It has been working fine for about 6 months or so. Today the power went out and when I came home the login Screen was there. I logged in as normal. and the Java Desktop will not come up, nor the CDE one. It looks like it is going to start but all it does is come back to the login screen. I can login with the command prompt and failsafe just no desktop. All of my services is running from what I can tell my ipforwarding, apache, mysql all working fine. Just won't let me in the desktop. I ran the fsck -F ufs and rebooted but it did not resolve i...

Hi We are getting the following error, whenever we try to link any application 1. a simple 'hello world' program ERROR ---------------------------------------------------------------------- ----------- exec(): 0509-036 Cannot load program /usr/ccs/bin/bind64 because of the following errors: 0509-130 Symbol resolution failed for /usr/lib/libcrypt.a[shr_64.o] because: 0509-136 Symbol __extension_status (number 0) is not exported from dependent module /usr/lib/threads/libc.a[shr_64.o]. 0509-130 Symbol resolution failed for /usr/lib/threads/l...

hwgui activex error on SAY ... LINK
Hi all, On the instruction SAY .. LINK: FUNCTION AcercaDe() PRIVATE oIconAcerca PRIVATE oAcerca oIconAcerca := HIcon():AddResource( "ICABOUT" ) INIT DIALOG oDlg TITLE "About me ..." ; AT 0, 0 SIZE 500, 380 ICON oIconAcerca ; STYLE DS_CENTER @ 90, 10 IMAGE oImaApp SIZE 320, 160 // @ 30, 46 ICON oIcoApp ID 1201 SIZE 32, 32 @ 30, 180 SAY MiDesVersion( "ufdbparam.exe" ) SIZE 440, 36 STYLE SS_CENTER ; FONT HFont():Add( 'Arial Black',0,-23,400,,, ) @ 30, 220 SAY "by Marcelo Anelli C." LINK "ht...