HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- global variable of C++ on HP-UX 11i
Operating System - HP-UX
1829705
Members
2437
Online
109992
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:05 PM
03-27-2007 05:05 PM
global variable of C++ on HP-UX 11i
Hi All,
If we use global variable of C++ on HP-UX, do we need to staticaly link due to limitations of the HP libs. Would Dynamic loading cause problems with globals being define more than once.
According to the below URL, do we need to compile using +tls=dynamic ?
http://docs.hp.com/en/5187-0701/ch07s09.html
So my question is that, can we need to run global variable of C++ on HP-UX 11i ?
If we use global variable of C++ on HP-UX, do we need to staticaly link due to limitations of the HP libs. Would Dynamic loading cause problems with globals being define more than once.
According to the below URL, do we need to compile using +tls=dynamic ?
http://docs.hp.com/en/5187-0701/ch07s09.html
So my question is that, can we need to run global variable of C++ on HP-UX 11i ?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2007 05:49 PM
03-27-2007 05:49 PM
Re: global variable of C++ on HP-UX 11i
This should be under: languages and scripting
>HP-UX 11i
This isn't specific enough, what OS version?
What's the real issue? What doesn't work? You just use a global and you access it.
You can link with archive or shared libs. In the archive case, you only have one definition and lots of externs. If you link with shared libs, you can violate the ODR rule and have multiple definitions, one in each shlib. You shouldn't do this if you can help it.
If these are PODs, no problem, dld will make it look like there is only one copy. If there is runtime initialization, the same storage may be initialized N times. This can cause problems depending on the constructor destructor.
If you are doing dynamic loading, you could have problems (multiple disjoint copies) depending on binding modes. But basically, dld chooses the first in binding order.
>+tls=dynamic
This is probably unrelated. TLS is an orthogonal attribute.
>HP-UX 11i
This isn't specific enough, what OS version?
What's the real issue? What doesn't work? You just use a global and you access it.
You can link with archive or shared libs. In the archive case, you only have one definition and lots of externs. If you link with shared libs, you can violate the ODR rule and have multiple definitions, one in each shlib. You shouldn't do this if you can help it.
If these are PODs, no problem, dld will make it look like there is only one copy. If there is runtime initialization, the same storage may be initialized N times. This can cause problems depending on the constructor destructor.
If you are doing dynamic loading, you could have problems (multiple disjoint copies) depending on binding modes. But basically, dld chooses the first in binding order.
>+tls=dynamic
This is probably unrelated. TLS is an orthogonal attribute.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 01:20 PM
03-28-2007 01:20 PM
Re: global variable of C++ on HP-UX 11i
> This isn't specific enough, what OS version?
bash-2.04# uname -a
HP-UX rsasj-hp B.11.11 U 9000/785 2003522226 unlimited-user license
>What's the real issue? What doesn't work?
>You just use a global and you access it.
We use a global and dynamic link using C++.
This program was developed by Apache plugin.
The core is rarely occured when apache start.
Here is the trace of gdb for core
(gdb) bt
#0 0xc83a43b8 in
warning: Attempting to unwind past bad PC 0xc83a43b8
#1 0xc944fbe4 in __rw::__rb_tree< ... >::_C_get_link (this=0x79f26f1c)
...
--------------------
You can link with archive or shared libs. In the archive case, you only have one definition and lots of externs. If you link with shared libs, you can violate the ODR rule and have multiple definitions, one in each shlib. You shouldn't do this if you can help it.
--------------------
What does ODR stand for ?
What does PODs stand for ?
--------------------
If these are PODs, no problem, dld will make it look like there is only one copy. If there is runtime initialization, the same storage may be initialized N times. This can cause problems depending on the constructor destructor.
If you are doing dynamic loading, you could have problems (multiple disjoint copies) depending on binding modes. But basically, dld chooses the first in binding order.
>+tls=dynamic
This is probably unrelated. TLS is an orthogonal attribute.
--------------------
What is "orthogonal attribute" ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2007 03:45 PM
03-28-2007 03:45 PM
Re: global variable of C++ on HP-UX 11i
>We use a global and dynamic link using C++.
This program was developed by Apache plugin.
This is dynamic loading.
#0 0xc83a43b8 in
warning: Attempting to unwind past bad PC 0xc83a43b8
#1 0xc944fbe4 in __rw::__rb_tree< ... >::_C_get_link (this=0x79f26f1c)
It appears you have branched to a shlib you have unloaded?
_C_get_link seems to only call _C_add_new_buffer. If you had this function in multiple shlibs, and unloaded one of them, you could have this problem. So it could be related to duplicate functions not globals.
>What does ODR stand for?
One Definition Rule
>What does PODs stand for?
Plain Old Data
>What is "orthogonal attribute"?
Unrelated, as in 90 degrees from.
This program was developed by Apache plugin.
This is dynamic loading.
#0 0xc83a43b8 in
warning: Attempting to unwind past bad PC 0xc83a43b8
#1 0xc944fbe4 in __rw::__rb_tree< ... >::_C_get_link (this=0x79f26f1c)
It appears you have branched to a shlib you have unloaded?
_C_get_link seems to only call _C_add_new_buffer. If you had this function in multiple shlibs, and unloaded one of them, you could have this problem. So it could be related to duplicate functions not globals.
>What does ODR stand for?
One Definition Rule
>What does PODs stand for?
Plain Old Data
>What is "orthogonal attribute"?
Unrelated, as in 90 degrees from.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP