Operating System - OpenVMS
1753511 Members
4972 Online
108795 Solutions
New Discussion юеВ

Re: Strange behavor of HP C++

 
Alex Chupahin
Super Advisor

Strange behavor of HP C++

Hello.

I'm simply compiling 2 sources then making library.
---------------------------------------------------
$CXX /INCLUDE=([],[-],[--.include]) /DEFINE=(__USE_STD_IOSTREAM)/WARN=DIS=EXTRASEMI/DEB /LIST/SHOW=ALL UFSCOMMON.CC

$CXX /INCLUDE=([],[-],[--.include]) /DEFINE=(__USE_STD_IOSTREAM)/WARN=DIS=EXTRASEMI/DEB /LIST/SHOW=ALL STOREFSUFS.CC

$LIB/CREA UFS.OLB UFSCOMMON.OBJ,STOREFSUFS.OBJ
%LIBRAR-E-DUPGLOBAL, global symbol STRINGHASWHITESPACE from file STOREFSUFS.OBJ;1 already in library
----------------------------------------------------

It is mean that the global STRINGHASWHITESPACE
already in library, i.e. function statement is present in both UFSCOMMON.CC and STOREFSUFS.CC
Ok.
Looking to the compilation listing:
--------------------------------------------------
$ SEARCH UFSCOMMON.LIS stringHasWhitespace
I3 46190 SQUIDCEXTERN int stringHasWhitespace(const char *);
E extern "C" int stringHasWhitespace(const char *);
I1 50774 stringHasWhitespace(const char *s)
--------------------------------------------------
We can see in at the line 46190 a function describing as
"extern "C" int stringHasWhitespace(const char *); and then at the line 50774 function code statement "stringHasWhitespace(const char *s)" that name is treated as global symbol of course. (Need to say that the same statement is in STOREFSUFS.LIS). So duplicate name reason is in our eyes.
Ok.
But I split compilation process into preprocessor stage and compilation itself via /PREP key:
---------------------------------------------------
$CXX /INCLUDE=([],[-],[--.include]) /DEFINE=(__USE_STD_IOSTREAM)/WARN=DIS=EXTRASEMI /DEB /LIST/SHOW=ALL /PREP UFSCOMMON.CC

$CXX /LIS=ufscommon_ixx.lis UFSCOMMON.IXX

$CXX /INCLUDE=([],[-],[--.include]) /DEFINE=(__USE_STD_IOSTREAM)/WARN=DIS=EXTRASEMI /DEB /LIST/SHOW=ALL /PREP STOREFSUFS.CC

$CXX /LIS=STOREFSUFS_IXX.LIS STOREFSUFS.IXX

$SEARCH UFSCOMMON_IXX.LIS stringHasWhitespace

36045 extern "C" int stringHasWhitespace(const char *);
-----------------------------------------------

How can you see, THERE IS NO function statement "stringHasWhitespace(const char *s)"
(as it really should be)
And then I can make library without problems:

$LIB/CREA UFS.OLB UFSCOMMON.OBJ,STOREFSUFS.OBJ

Any suggestions??
2 REPLIES 2
Hoff
Honored Contributor

Re: Strange behavor of HP C++

The usual trigger for the DUPGLOBAL is the librarian seeing duplicate globals declared.

Check the full compiler listings for the modules, and see what's getting declared.

If that doesn't help, please post up a (small) reproducer of this case. (I really don't want to wade through all of downloading and unpacking and configuring what I presume is Squid here to build a reproducer myself.)

Please also post up the compiler version and OpenVMS version and architecture.
Alex Chupahin
Super Advisor

Re: Strange behavor of HP C++

Should find solution at another place