[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

3570.0. "cxxlink and sys$lib_c.tlb?" by CSC32::J_HENSON (Don't get even, get ahead!) Tue May 13 1997 21:57

c++ v5.5-017 for OpenVMS Alpha V7.1

When cxxlink is used to build an image in which the source includes
an include from sys$libr_c.tlb such as namdef, it fails because
it can't find that include file.  The command procedure listed below
illustrates this.

When compiling, I can explicitly reference sys$library:sys$lib_c.tlb, but
I don't know how to do that with cxxlink.  I can define the
appropriate include library logical and be ok, but it's still kind
of confusing.

Is this a bug?  If not, shouldn't we provide a better explanation of
what is going on?

Thanks,

Jerry

===========================================================

$create tstinc.cxx
#include "myclassa.h"

main() {
    MCB x;
    cout << x;
}
$create myclassa.h
//
// File: MYCLASSA.H
//
#ifndef MYCLASSA_LOADED
#define MYCLASSA_LOADED
#include "myclassb.h"
#include <iostream.h>

template <class T> class myClassTemplate {
public:
    T foo;
    int foobaz() { return foo.baz(); }
};

typedef myClassTemplate<myClassB> MCB;

template <class T>
ostream& operator<<(ostream& os, myClassTemplate<T>& xc) {
    os << xc.foobar();
    return os;
}
#endif
$create myclassb.h
//
// File: MYCLASSB.H
//
#ifndef MYCLASSB_LOADED
#define MYCLASSB_LOADED
#include <nmadef.h>

class myClassB {
public:
typedef enum { FAcc = NMA$C_PCLI_ACC, FAcc1 } mCid;
    int x;
    int baz() { return FAcc + x; }
};
#endif
$cxx tstinc+sys$library:sys$lib_c/lib
$cxxlink tstinc

T.RTitleUserPersonal
Name
DateLines
3570.1CXXLINK/SYSEXE ?CUJO::SAMPSONWed May 14 1997 02:0520
	Here's the way it generally has worked for me:

In the source code, e.g.:

#include "hwrpbdef.h"
#pragma extern_model save
#pragma extern_model relaxed_refdef
extern "C" HWRPB *BOO$GA_HWRPB;
#pragma extern_model restore

To compile, e.g.:

$ CXX alpha_console_info+sys$library:sys$lib_c.tlb/library

To link and resolve symbols from SYS$BASE_IMAGE.EXE, e.g.:

$ CXXLINK/SYSEXE alpha_console_info

	HTH,
	Bob Sampson
3570.2Had to verify that cxxlink wasn't turning it offHNDYMN::MCCARTHYA Quinn Martin ProductionWed May 14 1997 09:353
Just an fyi - /NOSYSEXE is the default.

bjm
3570.3cxx-f-noincludefile error on cxxlinkCSC32::J_HENSONDon't get even, get ahead!Wed May 14 1997 13:2016
Linking with /sysexe has absolutely no bearing on this issue.  It's not
one of the linker being unable to resolve external references.  Rather,
it has to do with cxxlink needing to load nmadef.h for whatever
reason.

Another way to state it is the the cxxlink operation fails with the
following error.

%cxx-f-noincludefile,....

in reference to nmadef.h.  If you change the cxxlink command in my
procedure to cxxlink/log, you will see even more detail.

Hope this clears things up.

Jerry
3570.4exitCUJO::SAMPSONWed May 14 1997 14:0412
    In that case, I would try
    
    #include "nmadef.h"
    
    instead of
    
    #include <nmadef.h>
    
    then compile as suggested in .1.
    
    I had thought you were trying to solve the general problem
    of linking to resolve system symbols.  Sorry.
3570.5no I have not tried it myself HNDYMN::MCCARTHYA Quinn Martin ProductionWed May 14 1997 14:0813
>>it has to do with cxxlink needing to load nmadef.h for whatever
>>reason.

It appears that one of the files generated for automatic template ins needs
to be compiled with the +sys$library qualifier.

The compiler generates the qualifiers used on the command line when the 
original source is compiled.  It looks like it does not include the use of "+"
on the command line.

You could try defining cxx$library_include to point at the tlb file.

bjm
3570.6yeah, but...CSC32::J_HENSONDon't get even, get ahead!Thu May 15 1997 14:0134
>>       <<< Note 3570.5 by HNDYMN::MCCARTHY "A Quinn Martin Production" >>>
>>                      -< no I have not tried it myself  >-

>>It appears that one of the files generated for automatic template ins needs
>>to be compiled with the +sys$library qualifier.

>>The compiler generates the qualifiers used on the command line when the 
>>original source is compiled.  It looks like it does not include the use of "+"
>>on the command line.

>>You could try defining cxx$library_include to point at the tlb file.

I already know that defining cxx$library_include will resolve the problem.
My question is should the cxxlink command have a way to deal with this
similar to using the +sys$library:sys$lib_c/lib capability of the
cxx command.

Or, should the documentation be amended to reflect this situation.  

Or, do we want to just not do anything and let customers struggle with 
this on their own.

This is by no means a hot issue, but it is one that needs to be raised
and considered (imho, of course).

FWIW, I'll probably write a stars article on this the next chance I get,
so the csc will at least have something for customers to read.   Before
writing the article, though, I would like to get a reading from engineering
as to whether or not this is considered worthy of consideration, or just
a minor inconvenience.

Thanks,

Jerry