HP OpenVMS Systems

ask the wizard
Content starts here

DEC C++ repositories and object libraries?

» close window

The Question is:

 
I have user library of C++ modules. The build command was :
    $ library/create/object usrlib [ list of modules ]
 
I can link applications as long as I have some stuff at my cxx_repository, that's been created when I compiled modules for usrlib. Once I lose the cxx_repository files, I get 'unresolved references' when trying to link. What information regarding the link
ing with C++ library might help in that way ?
 
 


The Answer is :

 
  The specified LIBRARY command loads a specified list of object modules
  into an object library.  (It is not what would normally be refered to
  as a "build" command.)
 
  With C++, one normally uses the CXXLINK facility to link programs.
  CXXLINK is a wrapper around LINK, and you can use CXXLINK/LOG to see
  what CXXLINK is doing with LINK.
 
  If you do not use templates, then you will likely want to specify the
  /NOTEMPLATE_PRELINK and /REPOSITORY qualifiers on the CXXLINK command.
  You will also want to be aware of the /[NO]TEMPLATE_DEFINE=opt (or the
  #pragma define_template cmmand) and the /REPOSITORY compiler qualifiers,
  as well as the compiler's include (template) processing.
 
  The section of the DEC C++ user documentation that covers the linking
  of C++ applications might be of interest to you, and the section on
  using C++ templates will definitely be of interest.  (Work that will
  improve the user-visible behaviours involved with building applications
  with templates is expected.)  The documentation also includes recommended
  organization of C++ code for code that does and does not use templates,
  and for how to build a standalone library (containing object code and
  templates)
 
  Here is an example of a C++ object library creation procedure:
 
$ define/trans=concealed lroot disk:[windows_library.]
$ define lbuild lroot:[build]
$!
$! Compile and partially link each source separately using the same repository:
$!
$!    /repository option causes all template instantiation files and objects
$!         to be placed in the [.build.repository] directory; you must specify
$!         the same repository for each cxx and cxxlink command
$!
$!    /object option causes the source object files to be placed in the build
$!         directory
$!
$!    cxxlink/noexe commands ensure that both the source and template
$!         instantiations are compiled but no executable is generated
$!
$ cxx lroot:[src]w1.cxx /include=lroot:[include] -
    /repos=lroot:[build.repository] /object=lbuild:w1.obj
$ cxxlink/noexe lbuild:w1.obj /repos=lroot:[build.repository]
$!
$ cxx lroot:[src]w2.cxx /include=lroot:[include] -
    /repos=lroot:[build.repository] /object=lbuild:w2.obj
$ cxxlink/noexe lbuild:w2.obj /repos=lroot:[build.repository]
$!
$! ... and so on for all library source files
$!
$! And now place all the source objects and template instantiation objects
$! into the object library
$!
$ lib/create lbuild:libwindows.olb lbuild:*.obj,lroot:[build.repository]*.obj
 
 

answer written or last revised on ( 9-JUL-1998 )

» close window