[Info-vax] Possible C compiler static variable initialization problem.
JohnF
john at please.see.sig.for.email.com
Wed Feb 26 06:57:53 EST 2014
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.
> Any thoughts or suggestions on the solution are welcome.
> Thanks, Bill.
Your problem description starts off,
I have a situation where in C I have defined:
_stringlist *dblist = NULL;
This happens to be in the file with the failing function.
Then in the header file shared by two files I have:
extern _stringlist *dblist;
That sounds to me like your first file ultimately
contains >>both<< statements
extern _stringlist *dblist; /* from the shared .h file */
_stringlist *dblist = NULL; /* coded directly in the file */
possibly in the reverse order, depending on where your #include is.
You >>don't<< want that extern in the module defining/allocating it.
So that would be wrong (or I'm mis-reading you and I'm wrong).
--
John Forkosh ( mailto: j at f.com where j=john and f=forkosh )
More information about the Info-vax
mailing list