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

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3544.0. "automatic template instantiation questions" by HYDRA::DORHAMER () Sat Apr 19 1997 17:48

A software partner, Manugistics, needs some help with template resolution.
They are using DEC C++ v5.5 on Digital UNIX v3.2G.  I have pointed him to the 
"Using DEC C++" manual and sent him the section on automatic template 
instantiation.  Any other pointers to help him get started or answer his 
questions on template resolution would be much appreciated.

An e-mail with his questions is attached.  He had included a long
listing with his make file output and some sample .cmd files from his
cxx_repository directory.  Since these were lengthy, I did not include
them here, but they can be found in the tar file manugistics.tar in the
anonymous ftp area on fluid.mro.dec.com.

Thanks,
Karen

From:	SMTP%"[email protected]" 14-APR-1997 15:34:47.38
To:	alpha-developer <[email protected]>
CC:	
Subj:	Attn: Karen Dorhamer - Build Problem

Karen,

As we discussed on the phone, here is a description of the build problem
I am having along with some supporting files.

We are building a large application using C++, Object Space's System
Toolkit 2.0 (STL), and Orbix 2.0.  I recently began porting to the
alpha.  We are runing Digital Unix (osf1) 3.2G and version 5.5 of the
C++ compiler (I include a listing of the
/usr/lib/cmplrs/cxx directory).

The problem seems to be in the template resolution.  As with other
platforms, I notice that the DEC auto-instatiates the templates into
.cxx files in the repository directory along with matching .cmd files
which seem to represent compiler options which
will be used to build the .cxx files into .o files for inclusion into
the libraries or executables.

The first thing I noticed was that the OSF cxx compiler, unlike most
platforms, requires a space beween certain options and the values they
take such as '-o', '-ptr', and '-ptsuf'.  So, I specify options such as
'-ptr ./ptrepositoryD' and '-ptsuf ".cc .icc
.ipp .cxx ..."'.  If I omit the spaces, these options generate errors or
are ignored, and if I leave out the suffix list and specify the
-define_templates flag, I get an error because we have template
definitions in a .icc file.  However, I noticed in the
.cmd files in the repository, the spaces are gone and the quotes in my
suffix list are gone, so the repository that actualy contains the .cxx
files is ignored.  I got around this first problem by leaving out the
'-ptr' flag and using the default
repository.  But then, the suffix list generates errors or warnings and
the various .cxx files are not found and don't get compiled and I end up
with many unresolved externals.  Editing the .cmd files to add the space
and the quotes back into the suffix
list does not seem to help.  If I omit the suffix list and the
-define_templates option (An option I usually don't use, but using it
doesn't help), then those templates it does find and create .cxx files
are created and compiled into .o files successfully,
but many unresolved externals still exist from the ones it didn't find.

The final problem is that some of the .cxx files it tries to find during
the link such as sem_wait.cxx and others simply aren't there.  These
seem os related and this may just be something I'm missing.  This
doesn't seem exactly like the other problem and
may or may not be related, but if you can help, that would be great.

My questions are (all basically why aren't the templates being
resolved?):

   Is there any way to make the compiler not need the spaces between the
option tag and its value?
   Do I have the correct format for the suffix list?
   Why do the .cmd files have the wrong option format even though they
are based on my compiler options?
   Why are certain .cxx files that the compiler looks for not in the
repository and others are there but ignored?
   Will changing our names to use only standard suffixes (what are
they?) and leaving out the '-ptsuf...' option alleviate some of the
problem for now.
   Is there anything else about template auto-instantiation and
resolution under the osf c++ compilers that I am missing and that may be
contributing to my problems?
   Are there any other manuals on the OSF1 build
environment/tools/compilers/c++/templates?


Output of build.  This directory is one of many.  This particular build
makes a library (works fine) and the an executable (eservice) that uses
that library and others.  It is the link of this executable that fails.

(See attached file: mak.out)

Directory listing of cxx_repository after compile and attempt at link:

(See attached file: repos.lst)

Directory listing of /usr/lib/cmplrs/cxx:

(See attached file: cmplrs.lst)

Sample .cmd files generated in cxx_repository from compile:

(See attached file:
append_helper__49basic_string__Tc16char_traits_char13allocator__TcXcUl.c
md)

(See attached file:
append_helper__49basic_string__Tc16char_traits_char13allocator__TcXPCcUl
.cmd)


If you need any further information, please contact me as soon as
possible as this is holding up a port for a major client.

Thanks for your help.



                                         Kevin McBride
                                         Manugistics
                                         (301) 984-5364
                                         [email protected]
T.RTitleUserPersonal
Name
DateLines
3544.1Here are some answers you can provide the customer. Hope this helps.DECC::FOLTANMon Apr 21 1997 18:1585
>   Is there any way to make the compiler not need the spaces between the
>option tag and its value?

No.

>   Do I have the correct format for the suffix list?

Yes.  You need to specify a space.  For example,

	cxx -ptr ./my_rep -ptsuf ".c.inc" t1.cxx

>   Why do the .cmd files have the wrong option format even though they
>are based on my compiler options?

The .cmd files do not have the wrong option format.
The .cmd files are used internally by the DEC C++ driver 
to invoke the DEC C++ compiler image directly.  If you
specify -v on the command line you will notice that the
DEC C++ driver changes for example "-ptr ./my_rep" to
"-ptr./my_rep" when invoking the compiler image in
/usr/lib/cmplrs/cxx.

>   Why are certain .cxx files that the compiler looks for not in the
>repository and others are there but ignored?

This is a hard question to answer without an example.  I 
can only guess that based on your previous experiences with
the -ptr command line option that the compiler is looking
in the wrong repository and not finding the correct instantiation
source files.  As to why other instantiation source files in
the repository might be ignored maybe due to specializations
that you have specified within your source program.  The DEC C++
compiler sees a request for a template and creates an
instantiation source file in the specified repository.  At
link time if another module of your application contains
a specialization of that template, your request is satisfied
and the compiler does not proceed further to compile the 
instantiation source file in the repository.

>   Will changing our names to use only standard suffixes (what are
>they?) and leaving out the '-ptsuf...' option alleviate some of the
>problem for now.

The -ptsuf option can be specified by providing a list 
of file name extensions that are valid for your 
template definition files. The list must be contained in
quotation marks and a space must present between -ptsuf
and the list.  Currently we do not have any known problem
reports against the -ptsuf command line option.  Given
some of the explainations above please try specifying
the -ptsuf option again.  For example, I wrote a quick
program that worked with V5.5 where the template definition
file had a file name extension of ".inc".

	cxx -v -ptsuf ".inc" t1.cxx

If you are still having problems please send a reproduceable
example and we will take a look.


>   Is there anything else about template auto-instantiation and
>resolution under the osf c++ compilers that I am missing and that may be
>contributing to my problems?
>   Are there any other manuals on the OSF1 build
>environment/tools/compilers/c++/templates?

From your problem description is sounds like that most of your
problems are originating from the command line options.  I hope 
some of my answers to the above questions will solve
the problems you are experiencing with DEC C++ template automatic
instantiation.  The documentation I can point you at is 
the "Using DEC C++ on Digital UNIX" manual which I 
believe Karen Dorhamer has already suggested.  Also there
is some last minute information in the release notes for
V5.5 that might be of value as well.  You can find the 
release notes on your system in the /usr/lib/cmplr/cxx
directory.

Hope this helps,

Lois D. Foltan
DEC C++ Development