Operating System - OpenVMS
1819696 Members
3389 Online
109605 Solutions
New Discussion юеВ

/NAMES=(AS_IS,SHORTENED) and /NAMES=(UPPERCASE,TRUNCATED)

 
Bo_fremling
New Member

/NAMES=(AS_IS,SHORTENED) and /NAMES=(UPPERCASE,TRUNCATED)

Does it exist a solution to this problem?
We are linking a lecacy ACMS-application against a new C++ library and the differenses in the libraries results in undefined symbols.
The symbols exists but in CamelCase (LikeThis) and the linker are looking for all uppercase since the ACMS code is compiled with the default /NAMES=(UPPERCASE,TRUNCATED).

Is there a way to get the linker to connect things compiled whith /NAMES=(UPPERCASE,TRUNCATED) and /NAMES=(AS_IS,SHORTENED)?

If not then it means that a resulting image containing some object code made with /NAMES=(AS_IS,SHORTENED) CAN NOT contain
ANYTHING compiled with the default /NAMES=(UPPERCASE,TRUNCATED)?

/Bo Fremling
BAE Systems H├дgglunds

Alpha Openvms 8.2
3 REPLIES 3
Craig A Berry
Honored Contributor

Re: /NAMES=(AS_IS,SHORTENED) and /NAMES=(UPPERCASE,TRUNCATED)

There are various tricks, but nothing that is guaranteed to work in all cases or avoid giving up something. Don't overlook the simple possibility of compiling the new C++ code with (UPPERCASE,TRUNCATED), though of course you may have symbols that are too long to get away with that.

One of the more robust options is to build the new library as a shareable image and use aliases in the linker options file, something like the following (but read the section on aliases in the Linker Utility manual):

MYLIB/SHAREABLE
CASE_SENSITIVE=YES
SYMBOL_VECTOR =
(CAMELCASE1/CamelCase1=PROCEDURE,-
CAMELCASE2/CamelCase2=PROCEDURE)

The alias names here are just uppercase versions of the actual routine names. They could also be shorter versions if necessary.

Other than that all the options I'm aware of revolve around doing your own shortening and upcasing instead of letting the compiler do it for you; for example you could have macros that redefine all the long symbol names to something shorter and all the mixed case names to something in upper case.
Steven Schweda
Honored Contributor

Re: /NAMES=(AS_IS,SHORTENED) and /NAMES=(UPPERCASE,TRUNCATED)

If your externals are declared in header
files, it should be (relatively) easy to add
"#pragma names" directives to get the job
done. For example, bzip2 is normally
compiled with /NAMES = AS_IS, and the
Info-Zip Zip and UnZip programs are normally
compiled with (the default) /NAMES =
UPPERCASE, so to build, say, Zip with bzip2
support, it is compiled with /INCLUDE options
which direct it to use a special bzip2.h
header with some "#pragma names" directives
around its inclusion of the normal bzip2.h
header:

[...]
#pragma names save
#pragma names as_is

#include "INCL_BZIP2:BZLIB.H"

#pragma names restore
[...]

(where the logical name INCL_BZIP2 points to
the directory where the real bzip2.h
resides.)

This way, when compiling the Zip code, the
compiler will treat the bzip2 function names
AS_IS, but everything else with the usual
UPPERCASE. So, at link time, the linker will
be looking for mixed-case names in the bzip2
object library, even though all the other
external names are UPPERCASE.

The key is "#pragma names", and you can add
these to your code in different ways,
depending on how you would prefer to do
things. (The alternate header file seemed
like an easy way to avoid more "#ifdef VMS"
directives in the Zip code.)
Steven Schweda
Honored Contributor

Re: /NAMES=(AS_IS,SHORTENED) and /NAMES=(UPPERCASE,TRUNCATED)

And, of course, when I wrote "bzip2.h", I
meant "bzlib.h".