[Info-vax] VMS internals design, was: Re: BASIC and AST routines

Stephen Hoffman seaohveh at hoffmanlabs.invalid
Thu Dec 2 15:04:17 EST 2021


On 2021-12-01 21:23:41 +0000, hb said:

> On 12/1/21 8:50 PM, Stephen Hoffman wrote:
>> The Linker isn't particularly sensitive to API declarations, and will 
>> probably not notice any API differences. API contract "enforcement" 
>> here is usually by app failure.
>> 
>> Otherwise—if BASIC won't play nice with a one-argument AST 
>> declaration—specify the context pointer and whatever other four values 
>> will be tolerated by BASIC and the Linker.
> 
> The linker matches symbols, which represent references and definitions. 
> It complains if it can't find a matching definition for a reference. 
> The symbol name and the symbol type must match. That is the linker 
> knows about data and routines. It will not let you define an object for 
> a routine reference. That's more or less all the linker does, here.
> 
> With C++ you get the API encoded in the symbol name, also known as 
> "decorated" or "mangled" name. With matching such symbols the linker 
> implicitly checks the API and does notice a difference, that is, it 
> will print an unresolved reference warning. For example, if you call 
> (or  take the address of) "foo(int,int)" but only define a "foo(int)" 
> you will see
> 
> %ILINK-I-UDFSYM,        CX3$_Z3FOOII2INROLH
> %ILINK-W-USEUNDEF, undefined symbol CX3$_Z3FOOII2INROLH referenced 
> source code name: "foo(int, int)"


I'm aware of how the OpenVMS linker works here, as well as with the 
OpenVMS implementation of mangling, hence my comment quoted above.

Past resolving the associated symbol—symbol resolution which would 
necessarily happen with or without name mangling in use—the C and C++ 
name mangling doesn't involve the OpenVMS linker.

Nor does the OpenVMS linker check the APIs.

Mangling is in some ways used as a workaround for linker limits around 
symbol resolution (as is used on OpenVMS), and also used as a 
workaround for linker features lacking (across various languages and 
compilers and linkers, including as used on OpenVMS).

Mangling is a hack, but it's the hack we have.



-- 
Pure Personal Opinion | HoffmanLabs LLC 




More information about the Info-vax mailing list