Path: chuka.playstation.co.uk!news From: "Mario Wynands" Newsgroups: scea.yaroze.programming.codewarrior,scee.yaroze.programming.codewarrior Subject: Disappearing variables Date: Sun, 28 Dec 1997 19:08:56 +1300 Organization: PlayStation Net Yaroze (SCEE) Lines: 46 Message-ID: <684q0b$9ij5@chuka.playstation.co.uk> NNTP-Posting-Host: p16-max3.well.ihug.co.nz X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Xref: chuka.playstation.co.uk scea.yaroze.programming.codewarrior:264 scee.yaroze.programming.codewarrior:124 I seem to have a problem with Codewarrior when using external variables. Consider the following example // --------------------------------------------------------- // ENTITY.C file int num_entities; u_long* ReadEntities(u_long *addr) { /* some code */ num_entities = 5; /* some more code */ } // --------------------------------------------------------- num_entities is initialised externally and set in ReadEntities. After the assignment statement in ReadEntities num_entities holds the value of 5 for the remainder of the function and in any sub functions that ReadEntities might call. Outside of the ReadEntities function the num_entities value becomes garbage. External variables would appear to not be persistant on occasion (it does work in some cases). I have tried all sorts of different declaration methods including various creative extern usages, but to no avail. Any ideas anyone? Mario