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

Conference turris::vaxc

Title:VAX C Notes
Notice:READ 1.* BEFORE WRITING; USE KEYWORDS TO FIND EXISTING NOTES
Moderator:DECC::VMCCUTCHEON
Created:Sat Jan 25 1986
Last Modified:Mon Jun 02 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:5611
Total number of notes:27963

5607.0. "help on linking " by THYCO::BAGNASCO (De Consolatione Philosophiae) Fri May 02 1997 08:57

    Hi,
    
    a customer running VAXC V3.0 on VMS VAX V5.2 (an upgrade is not
    possible) need to use mktime and I'm going to give him the source 
    from note 2957.6 , to solve the coding problem he has.
    
    I should suggest to use it simply doing an:
    
    #include <sys$library:mktime.c>
    
    in any source that refers to mktime.
    
    This works, but the customer has may sources that will have to be
    modified, so this way can take a lot of time.
    
    On the other side,trying to link the original source with a command
    like:
    $link souce,mktime,sys$input/opt
    sys$share:vaxcrtl/share
    ^Z
    I get the following error:
    
    %LINK-W-NUDFSYMS, 1 undefined symbol:
    %LINK-I-UDFSYM,         MKTIME
    %LINK-W-USEUNDEF, undefined symbol MKTIME referenced
            in psect $CODE offset %X00000026
            in module NEW_ASCTIME file DUB7:[DELTA.PROVE]NEW_ASCTIME.OBJ;6
    
    That  disappear removing the static attribute in the first line of the 
    routine:
    
    static time_t mktime( timeptr );
    
    Could someone tell me if  "static" can be removed
    without create problems to the routine (since it seems to work, I 
    don't understand why it was used) or if there is a better way to link?
    
    Thanks in advance and excuse me for doing obvious questions, 
    I've not good skills on C,
    paolo
    
T.RTitleUserPersonal
Name
DateLines
5607.1TLE::D_SMITHDuane Smith -- DEC C RTLFri May 02 1997 10:358
    Why not create a new object library like:
    
      $ LIBRARY/CREATE/OBJECT VAXCRTL_EXTENSIONS
      $ CC MKTIME
      $ LIBRARY VAXCRTL_EXTENSIONS MKTIME
      $ DEFINE LNK$LIBRARY VAXCRTL_EXTENSIONS
    
    And then proceed to link as normal.  
5607.2Don't Alias Standard Functions/Modules Directly...XDELTA::HOFFMANSteve, OpenVMS EngineeringFri May 02 1997 11:2713
   I would recommend avoiding the use of the C standard routine names
   and the standard C header file names for non-DIGITAL code (beyond
   possibly inserting a stub for mktime.h, if that is missing from the
   antique version of VAX C in use), and I would avoid modifying the
   standard libraries -- use application-specific (local) variants and
   application-specific libraries (or shareables), and I would use a
   site-specific pre-processor #define to redirect the mktime routine
   call to the my_own_mktime routine.

   The result of this work will tend to avoid any really weird problems
   when these folks finally decide that an OpenVMS and DEC C upgrade is
   possible.
5607.3no yet working...THYCO::BAGNASCODe Consolatione PhilosophiaeFri May 02 1997 11:3724
    
    Hi,
    thanks for your quick answers !
    
    re .1 
    I create the library, insert the .OBJ and the link defining
    the logical lnk$library, as:
    @define lnk$library dub7:[test]vaxcrtl_extensions 
    but it continue to return the error:
    and then link with:
    $ link new_asc
    %LINK-W-NUDFSYMS, 1 undefined symbol:
    %LINK-I-UDFSYM,         MKTIME
    %LINK-W-USEUNDEF, undefined symbol MKTIME referenced
            in psect $CODE offset %X00000026
            in module NEW_ASC file DUB7:[TEST]NEW_ASC.OBJ;1
    $
    
    re .2 OK I'll do as you suggest about the name of the function..
    
    Thanks,
    paolo
    
    
5607.4LINKing using shareable image, object library...XDELTA::HOFFMANSteve, OpenVMS EngineeringFri May 02 1997 14:2921
   I'd tend to avoid LNK$LIBRARY -- it tends to get used by many
   different folks for different projects, and it thus tends to
   get used at unexpected times during unrelated LINKs.

   Instead, use:

	$ link new_asc,vaxcrtl_extensions/lib,sys$input:/opt
	sys$share:vaxcrtl/share
	$ 

   DEC C eliminated the need to explicitly specify the shareable
   image, as the use of the decc$ prefix (see /PREFIX=ALL) means
   that symbols in the shareable image can be resolved by the
   default search of IMAGELIB conducted by the LINKER.

   I'd also recommend upgrading to DEC C V3.2, if possible.  (If
   not an upgrade all the way to at least OpenVMS V5.5-2 and DEC C.) 
   I had encountered a number of compiler bugs in the VAX C V3.0
   (antique vintage) compiler.
   
5607.5No DEC C V3.2 that I know ofCXXC::REINIGThis too shall changeMon May 05 1997 10:236
  > I'd also recommend upgrading to DEC C V3.2, if possible. 
    
    I hope you meant VAX C V3.2.
    
    
                                    August G. Reinig
5607.6Of Two Minds On This Upgrade...XDELTA::HOFFMANSteve, OpenVMS EngineeringMon May 05 1997 10:369
:  > I'd also recommend upgrading to DEC C V3.2, if possible. 
:    
:    I hope you meant VAX C V3.2.

   Actually, I'd prefer this site upgrade to DEC C V5.5 or later, but
   yes, I'd meant to indicate "to VAX C V3.2", the last of the VAX C
   releases.  (DEC C is superior to VAX C in a number of ways...)