[Info-vax] Possible C compiler static variable initialization problem.
hb
end.of at inter.net
Wed Feb 26 04:15:38 EST 2014
On 02/26/2014 06:02 AM, JF Mezei wrote:
> On 14-02-25 23:36, BillPedersen wrote:
>> I have posted the description of the problem on the tickets section of VMS-Ports:
>>
>> https://sourceforge.net/p/vms-ports/tickets/79/
> ...
> The main program has an uninitialized dblist which is passed to
> add_stringlist.
As far as I can see, the address of dblist is passed. That is listhead
should contain the address of dblist. The value of listhead is
2147285136 aka 7FFCF890. That seems to be on the stack. The source code
extract doesn't show whether dblist should be on the stack or not.
> You need both declarations to be "extern" to tell the linker to make
> sure that all references to dblist refer to the same external storage.
No. "extern" declares the variable, usually without storage. If you only
have declarations, the linker will complain with an "%ILINK-W-USEUNDEF,
undefined symbol ,,,, referenced". Without the "extern" you have a
definition, which assigns storage for the variable. "Usually" depends on
the /extern_model.
More information about the Info-vax
mailing list