Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!gatech!purdue!decwrl!hplabs!hpda!hpcuhb!hp-ses!bd From: bd@hp-ses.SDE.HP.COM (Bob Desinger) Newsgroups: comp.sys.hp Subject: Re: name clash in PW library in HP-UX 6.2 Message-ID: <920020@hp-ses.SDE.HP.COM> Date: 4 Feb 89 02:27:09 GMT References: <2836@mhres.mh.nl> Organization: HP Software Engineering Systems, Palo Alto Lines: 42 Johan Vromans (jv@mhres.mh.nl) writes: > A program using the "rename" system call gets problems when > linked with -lPW: > $ cc t.c -lPW > ld: Undefined external - > _Error I get that on my 6.2 s300, too, when I link with -lPW. But when I don't use -lPW, I get the libc version of rename() that successfully links. Can you use that instead? (If you need other routines from the PWB, you may need to use "-lc -lPW" flags for the linker.) A look at some older HP-UX code for another architecture shows that the libc version is a real system call instead of a library call; it's a stub that jumps to the kernel routine. In this older code, the libPW version of rename() calls two other libPW routines, xlink() and xunlink(). xlink() declares Error as an extern char buffer, used by sprintf() and another call, no doubt for temporary storage to hold the formatted error message. I have never looked at any s300 source code, much less the 6.2 version, so I don't know if it's similar. I was hoping to find some magic linker flags or #include files mentioned on the PWB man page, but I couldn't find any man pages for PWB entry points on either the 300 or 800. Or, for that matter, in 4.3BSD or the SVID or even the Lapin book on "Portable C and Unix System Programming." I suppose I shouldn't be surprised; PWB was an internal Bell Labs thing, according to Lapin. Grepping through /usr/include/*.h and /usr/include/sys/*.h turns up two useful references to Error on the s300: /usr/include/macros.h:extern char Error[128]; /usr/include/oldmacros.h:char Error[128]; You definitely want here. By the way, doesn't appear on the s800---and you'll get the same error message if you use -lPW without -lc there, too. So if you can possibly switch to the kernel version in libc, do it for greater portability. -- bd