[comp.sys.sun] Question on GNU C -- Openwin compatibility

hista@jetson.uh.edu (12/30/90)

I am having some rather crazy problems with my recently installed GNU C
compiler on the Sun4 platform.  The installation and everything seems to
have gone fine and the compiler works with regular ansi files like a
charm.

But, when it comes down to files with inbuilt headers calling the xview
libraries, it messes up like mad.  The compilation throws out some
warnings and errors in linking.  After discussion with some of the other
local hackers, I have come to the conclusion that maybe the openwindows
platform, i.e. header files are not exactly ANSI-compatible.

I am sure there must be plenty of you out there who must be using GNU C
and its reputed ansi facilities in conjunction with the Xview libraries. I
would appreciate any suggestions to improve my situation.  Thanks in
advance.

 Aashish Malhotra 
 hista@jane.uh.edu  OR  malhotra@cs.uh.edu 

fischer@iesd.auc.dk (Lars P. Fischer) (01/09/91)

>>>>> On 30 Dec 90 01:04:00 GMT, hista@jetson.uh.edu said:

> I am having some rather crazy problems with my recently installed GNU C
> compiler on the Sun4 platform. ...

> when it comes down to files with inbuilt headers calling the xview
> libraries, it messes up like mad.

The header files for XView version 2 are set up to provide K&R C, ANSI C,
or C++. Unfortunately, the ANSI C version has syntax errors (!).  The
problem is this: When using a variabel number of arguments for a function
in ANSI C, you use the ellipsis notation, ie

  int printf (char*, ...);

XView make use of this a lot. For some functions, XView does not want to
tell anything about the arguments, hence

  int shhhh (...);

BUT this is illegal. "...there must be at least one named argument;...",
(K&R, 2.ed., p 155). To do that, one must say

  int shhhh ( );

That's an "old-style" declaration, with no type checking at all.  Below is
a patch for XView that fix the problem. save this article and go to
..../openwin/include/xview and say

   patch -p1 < xview.patch

If it complains about a reverse patch, just say "y" (I always mess up the
diff command. Sorry).

Happy Hacking!

Lars Fischer,  fischer@iesd.auc.dk

[[Ed's Note: Placed in archives - and I'll even update the index :) -bdg]]

FTP:	Hostname : titan.rice.edu (128.42.1.30)
	Directory: sun-source
	Filename : xview.patch
	Filesize : 8314 bytes

Archive Server Address: archive-server@rice.edu
Archive Server Command: send sun-source xview.patch