| 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].
|