From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,6f19a940ee5612a1 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,6f19a940ee5612a1 X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-12-16 03:26:44 PST Path: nntp.gmd.de!newsserver.jvnc.net!netnews.upenn.edu!news.cc.swarthmore.edu!psuvax1!uwm.edu!lll-winken.llnl.gov!decwrl!pa.dec.com!jac.zko.dec.com!usenet From: mccarthy@hndymn.enet.dec.com (Core Technology Group - Run Time Libraries) Newsgroups: comp.sys.dec,comp.os.vms Subject: Re: Difference VAX C DIR/ALL/ DEC C ? Date: 16 Dec 1994 11:26:44 GMT Organization: Core Technology Group Distribution: world Message-ID: <3crthk$3o0@jac.zko.dec.com> References: <1994Dec15.123948@axp2.umkc.edu> Reply-To: mccarthy@hndymn.enet.dec.com (Core Technology Group - Run Time Libraries) NNTP-Posting-Host: hndymn.zko.dec.com X-Newsreader: mxrn 6.18-28 Xref: nntp.gmd.de comp.sys.dec:20592 comp.os.vms:61424 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 |>#include |>#include |>#include /* some systems require instead */ |>#include |> |>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 |>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 --------------------------------------------------------------------------------