[Info-vax] Possible C compiler static variable initialization problem.

Simon Clubley clubley at remove_me.eisner.decus.org-Earth.UFP
Wed Feb 26 07:54:32 EST 2014


On 2014-02-25, BillPedersen <pedersen at ccsscorp.com> wrote:
> I have posted the description of the problem on the tickets section of VMS-Ports:
>
>      https://sourceforge.net/p/vms-ports/tickets/79/
>
> Basically, I have a pointer to a structure that is statically initialized as
> a Null and I then pass the address of that pointer to a function but the
> information seen in the function is not a Null and so the function goes nuts.
>
> This is code which works on Linux...
>

If it works on Linux and not VMS, I would start by looking at the difference
in linker behaviour.

On VMS, variables defined in different source files, but with the same name,
were traditionally treated as different variables by the linker and space
allocated for each variable definition.

On Linux, the binutils linker combines them up into the same variable and
only allocates the space for one variable.

(I don't know if this has changed on VMS in recent versions as I don't write
code, either on VMS or Linux, which depends on linker specific behaviour).

That would be the first thing I would check for given the symptoms you have
described.

Simon.

-- 
Simon Clubley, clubley at remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world



More information about the Info-vax mailing list