Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* Difference VAX C DIR/ALL/ DEC C ?
@ 1994-12-15 18:39 Gary Lee McDonald
  1994-12-16 11:26 ` Core Technology Group - Run Time Libraries
  0 siblings, 1 reply; 2+ messages in thread
From: Gary Lee McDonald @ 1994-12-15 18:39 UTC (permalink / raw)


Greetings,

  In trying to port a program from VAX to AXP I ran into the following problem.
==================
        /* test.c */
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <string.h>	/* some systems require <strings.h> instead */
#include <curses.h>

main() /* VMS version */
{
    char *dummy;
    char term[81];
    longname(dummy, term);
    printf("Terminal = %s\n", term);
    return(1);
}
=================

This snippet of code works as expected on the VAX (VAX C v.3.2-044), but
doesn't on AXP (DEC C V.4.0-000).  Both systems on OpenVMS v.6.1.  I do very
little C, so I may be missing something simple. :-)

No options on either compile; no options on link on AXP; on VAX it's 
$ link test,opt/opt, where opt.opt contains sys$share:vaxcrtl.exe/share.

Also the routine was originally named 'setup', which worked on VAX, but
'protection violation' on AXP.  Changing 'setup' to 'main' fixed that.

Thanks for any insight!

UMKC					GaryM.  
5100 Rockhill Road			Univ. of Mo. at K.C.
Cockefair Hall				(816) 235-1183
Room 2, Gary Lee McDonald		MCDONALD   @ CCTR.UMKC.EDU
Kansas City, Mo. 64110			POSTMASTER @ CCTR.UMKC.EDU


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Difference VAX C DIR/ALL/ DEC C ?
  1994-12-15 18:39 Difference VAX C DIR/ALL/ DEC C ? Gary Lee McDonald
@ 1994-12-16 11:26 ` Core Technology Group - Run Time Libraries
  0 siblings, 0 replies; 2+ messages in thread
From: Core Technology Group - Run Time Libraries @ 1994-12-16 11:26 UTC (permalink / raw)



In article <1994Dec15.123948@axp2.umkc.edu>, mcdonald@axp2.umkc.edu (Gary Lee McDonald) writes:
|>Greetings,
|>
|>  In trying to port a program from VAX to AXP I ran into the following problem.
|>==================
|>        /* test.c */
|>#include <stdio.h>
|>#include <ctype.h>
|>#include <signal.h>
|>#include <string.h>	/* some systems require <strings.h> instead */
|>#include <curses.h>
|>
|>main() /* VMS version */
|>{
|>    char *dummy;
|>    char term[81];
|>    longname(dummy, term);
|>    printf("Terminal = %s\n", term);
|>    return(1);
|>}
|>=================
|>
|>This snippet of code works as expected on the VAX (VAX C v.3.2-044), but
|>doesn't on AXP (DEC C V.4.0-000).  Both systems on OpenVMS v.6.1.  I do very
|>little C, so I may be missing something simple. :-)
|>

Gary,
	On OpenVMS AXP V6.1, the default curses package is BSD implmentation
and longname() is broken (as is almost every other routine) (I can say that, I
just completed updating the entire package to BSD 4.4 sources and addressing
most of the known problems).

	Also, longname() is really a curses routine and should be used within
the context of initscr() and endwin().  On OpenVMS VAX, or on OpenVMS AXP when
the module is compiled with /DEFINE=__VMS_CURSES, the longname() routine is
independent of the curses package.  

	The fixed BSD 4.4 sources will require the char *termbuf parameter to
be passed and it will be scanned as if it was a termcap entry on an Unix
machine.
	When the fixed version is released, the code could look like this:

#ifdef __VMS_CURSES
    longname(dummy, term);
    printf("Terminal = %s\n", term);
#else
    initscr();
    printf("Terminal = %s\n", ttytype);
    endwin();
#endif
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	!! This code will not work with the released version  !!
        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

|>No options on either compile; no options on link on AXP; on VAX it's 
|>$ link test,opt/opt, where opt.opt contains sys$share:vaxcrtl.exe/share.

	To work around this problem with the released version, you should add
/DEFINE=__VMS_CURSES to your cc command, this will give you back the behavior
you get on OpenVMS VAX (that is, the behavior for longname()).

	To link this on OpenVMS AXP, you need to link in
SYS$SHARE:VAXCCURSE.OLB:

$ link test, sys$input:/opt
SYS$SHARE:VAXCCURSE.OLB/LIB
<CTRL/Z>

|>Also the routine was originally named 'setup', which worked on VAX, but
|>'protection violation' on AXP.  Changing 'setup' to 'main' fixed that.

I think if you add /STANDARD=VAXC to your compile command the old code (without
the main()) will work.  I belive that the default for VAXC was to handle
modules without a main() routine differently to handle such 'applications' as
you posted.

-- 
--------------------------------------------------------------------------------
Brian J. McCarthy		| Internet: mccarthy@hndymn.enet.dec.com
Digital Equipment Corp.	        |
Nashua, NH
--------------------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-12-16 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-12-15 18:39 Difference VAX C DIR/ALL/ DEC C ? Gary Lee McDonald
1994-12-16 11:26 ` Core Technology Group - Run Time Libraries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox