[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2210.0. "LINK-W-USEUNDEF" by ZPOVC::NWE () Wed Jun 04 1997 05:33

Hi

Customer is having problem with linking of C program (pls see below).
 
Any advise or pointers are welcome.

regards,

Nwe

Alpha OPEN VMS 6.2 DEC C 5.2

ZPOTS5$NWE %$ type test.c
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<time.h>
#include<fcntl.h>

/*int putenv(const char*);
void tzset(void);
*/

main()
{
char* a;
a="tz=est%edt";
printf("%d\n",putenv(a));
tzset();
}

ZPOTS5$NWE %$ cc/prefix_library_entries=all_entries test
printf("%d\n",putenv(a));
..............^
%CC-I-IMPLICITFUNC, In this statement, the identifier "putenv" is implicitly dec
lared as a function.
at line number 16 in file SYS$SYSROOT:[SYSMGR]TEST.C;1

tzset();
^
%CC-I-IMPLICITFUNC, In this statement, the identifier "tzset" is implicitly decl
ared as a function.
at line number 17 in file SYS$SYSROOT:[SYSMGR]TEST.C;1

If the program is the same with two functions "putenv" and "tzset" declared
explicitly,

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<string.h>
#include<time.h>
#include<fcntl.h>

int putenv(const char*);
void tzset(void);

main()
{
char* a;
a="tz=est%edt";
printf("%d\n",putenv(a));
tzset();
}

$cc/prefix_library_entries=all_entries test

there is no compliation error as I have explicitly declared the two functions.

$ link test
%LINK-I-UDFSYM,         PUTENV
%LINK-I-UDFSYM,         TZSET
%LINK-W-USEUNDEF, undefined symbol PUTENV referenced
        in psect $LINK$ offset %X00000040
        in module TEST file SYS$SYSROOT:[SYSMGR]TEST.OBJ;2
%LINK-W-USEUNDEF, undefined symbol TZSET referenced
        in psect $LINK$ offset %X00000050
        in module TEST file SYS$SYSROOT:[SYSMGR]TEST.OBJ;2
T.RTitleUserPersonal
Name
DateLines
2210.1TLE::D_SMITHDuane Smith -- DEC C RTLWed Jun 04 1997 07:3911
    You are using functionality that was added in OpenVMS V6.2.  You have
    two choices:
    
       o  require OpenVMS V7.0 and above
       o  use the backport object library shipped with DEC C V5.6
    
    Information on the object library is available on the CRTL home page
    
       http://hndymn.zko.dec.com/crtl
    
    Duane
2210.2a fake putenv is pretty mindless...XDELTA::HOFFMANSteve, OpenVMS EngineeringWed Jun 04 1997 10:5611
:    ... You have two choices:

   Three choices....

       o Use a local variation of putenv (my_putenv) that calls
         lib$set_symbol or lib$set_logical.  (This is a pretty
	 mindless routine to create...)
    
   This avoids the OpenVMS V7.0 version requirement, and avoids
   the need for the V5.6 `backport' library...

2210.3TLE::D_SMITHDuane Smith -- DEC C RTLWed Jun 04 1997 11:353
    Maybe Steve could conjure up a mindless tzset() while he's at it...
    
    8-)
2210.4Adventures in Porting Code...XDELTA::HOFFMANSteve, OpenVMS EngineeringWed Jun 04 1997 14:5112
:    Maybe Steve could conjure up a mindless tzset() while he's at it...

   one can use the UTC-related system service calls and associated LIB$ calls,
   depending on what one is up to.  (These services are available in OpenVMS
   V6.0 and later.)  Not quite as mindless as putenv, but -- for the basic
   cases, at least -- not really that difficult, either...

   One might end up hacking a few other time-related C calls...

   Want me to whip out those locking routines while I'm at it, Duane?  :-)