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

Conference hydra::axp-developer

Title:Alpha Developer Support
Notice:[email protected], 800-332-4786
Moderator:HYDRA::SYSTEM
Created:Mon Jun 06 1994
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3722
Total number of notes:11359

3077.0. "Computer Modeling Group" by HYDRA::DONSBACH (Jeff Donsbach, Software Partner Engineering, DTN 297-6862) Thu Jan 23 1997 12:53

T.RTitleUserPersonal
Name
DateLines
3077.1email from Michael Brown of CMGHYDRA::AXPDEVELOPERAlpha Developer supportThu Jan 23 1997 17:31143
3077.2HYDRA::AMORELLIMon Feb 03 1997 17:4653
Mike,

Below please find some input on the template link problem. Please let us know if 
this input helps or not.

Regards,

Carl
--------------------------------------------------------------------------------
>    I'm having some troubles at link time with some of our template files.
            
>    At link time, the linker is finding all of our template .o files just
>    fine. However, we are getting one undefined symbol that shouldn't be
>    undefined.
    
>    static char* token_type_str[TG_LAST+1] =
>    {"UNKNOWN", "KEYWORD",  "REAL", "STRING", "INTEGER",
>     "INTEGER RANGE",   "OPERATOR", "END-OF-FILE",  "READ-ERROR",
>    "INCLUDE", 
>    "LAST"};
>    
>    The variable 'token_type_str' is the variable that is undefined at link
>    time. If I do an 'nm' command on the template .o file, I get:
>    
>    CurveListIterator__TP4Well.o:      token_type_str                   | 
>    0000000000000088 | U | 0000000000000088
>    
>    
>    Yet when I do an 'nm' command on other .o non-template files (that
>    include the 
>    same include files as the generated template file), I get:
>    
>    libdatasrc.a[cntdgprs.o]: token_type_str                   |
>    0000000000015488 | d | 0000000000000088
        
There are some things to keep in mind when using "static" declarations with 
templates. The documentation says (section 5.1 Automatic Instantiation Quick 
Start)
        
	�   Use of static data and functions in template
            files is not supported.
        
       	    Because template declaration and definition files are
            header files, you must treat them as such. In template
            request mode, DEC C++ considers any references to static
            functions and data items as external references, and this
       	    consideration leads to unresolved symbols at link time.
        
        You may be running into this.

	You probably don't need/want the array declared "static", because EVERY 	
	.o whose .c includes 'kwsys.h' will have a copy of the
	array [8*12 = 96 bytes] and the string literals [~ 100 bytes].