Operating System - HP-UX
1832611 Members
3113 Online
110043 Solutions
New Discussion

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

 
SOLVED
Go to solution
Rajanarayana P K
New Member

aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

Hi
I have written a program as below in HP-UX 11.31
Made use of aCC compilor. This defined the _SOCKLEN_T and the code within #define is compiled

----------------------------------
$ > cat checkHello1.cxx
#include
using namespace std;


int main()
{
#if defined(_SOCKLEN_T)
cout << "Inside define _SOCKLEN_T Hello " << endl;
#endif
cout << "outside define _SOCKLEN_T" << endl;

return 0;

}

-----------------------------
Compiled this program as below

$ /opt/aCC/bin/aCC -o checkHello1 checkHello1.cxx

Result I got is

$ ./checkHello1
Inside define _SOCKLEN_T Hello
outside define _SOCKLEN_T

$ uname -s -r -v
HP-UX B.11.31 U

So compilor preprocessing assumed define _SOCKLEN_T.


The same code works fine in HP-UX 11.23

Follwoing is result I got in HP-UX 11.23

$ ./checkHello1
outside define _SOCKLEN_T
$ uname -s -r -v
HP-UX B.11.23 U

Did any one faced this issues?

Is it a issue with compilor or environment?

7 REPLIES 7
Laurent Menase
Honored Contributor

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

The ANSI C standard reserves all symbols starting with _[A-Z] for the implementation.
Applications should not use or depend on such symbols in any way, unless documented.
(For example, the _HPUX_SOURCE symbol is documented for application use.) The _SOCKLEN_T symbol is not documented in any HP-UX manual. It is an internal implementation detail. An application that defines or changes its behavior based on this symbol is incorrect.



if you want to use POSIX API then use xopen socket preprocessors as defined in man xopen_networking.

Else the default API is BSD one.

So it is a code problem.
Also it is not because socklen_t is defined that accept() will use it in its API.
on hpux socklen_t is always a long.


Rajanarayana P K
New Member

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

Thanks Laurant,
Is this reserving _[A-Z] introduced in HP-UX 11.31 onwards?
The compilation works fine in HP-UX 11.23.

We are using gSOAP library version 2.7.8 which is opensource. It is defined the _SOCKLEN_T and based on that defines
SOAP_SOCKLEN_T socklen_t

Where as in HP-UX it suppose to pick up define __hpux and assign
SOAP_SOCKLEN_T int

So I tried the sample program.

Now I am clear that I need to change this opensource header file accordingly to suite for HP-UX 11.31
Laurent Menase
Honored Contributor

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

> Is this reserving _[A-Z] introduced in HP-UX 11.31 onwards?

In fact no it is ANSI C which tell that.

the diff between 11.23 and 11.31 is that a header file defines _SOCKLEN_T - for internal purpose definition facilities apparantly.


and yes you need to change gSOAP precheck code
if you want to use bsd semantic.
Dennis Handly
Acclaimed Contributor
Solution

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

>The same code works fine in HP-UX 11.23

It is working fine on both OS versions.

>Is it a issue with compiler or environment?

The compiler only does what it is told. As Laurent said, this is a user problem due to the changes for Unix 2003 branding on 11.31.

> Is this reserving _[A-Z] introduced in HP-UX 11.31 onwards?

No, this Standard rule has always been there and the HP-UX headers take full advantage of it.

>I need to change this opensource header file accordingly to suite for HP-UX 11.31

It's unfortunate but you'll have to do that.

>Laurent: The ANSI C standard reserves all symbols starting with _[A-Z] for the implementation.

I see no C here. But the C++ Standard says the same thing and more.
sistemas unix_1
Advisor

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

Hello

I have the same problem
What version of gSOAP installed to fix it?
Andre-Marcel Hellmund
Frequent Advisor

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

Hey,

I was facing the same problem in the build environment of our ISV partners. The final result of all the discussions was that the gSOAP code is wrong because it relies on a macro which is purely implementation defined (though open to changes). We finally agreed on changing the header files. Since this problem doesn't seem to be solved yet, I think it would be a good idea to put the developers' attention to this problem since their code doesn't work properly for all HP-UX versions.

Best regards,
Andre-Marcel
Rajanarayana P K
New Member

Re: aCC compiler preprocessing assumes _SOCKLEN_T as defined in HP-UX 11.31

Hi
We fixed it by correcting the header files of gSOAP for this version of HPUX.

Regards
-Raj