Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.beginners Subject: Re: Object files and linking Date: Fri, 17 Jul 1998 21:50:41 +0100 Organization: Sony Computer Entertainment Europe Lines: 41 Message-ID: <35AFB921.F692044A@scee.sony.co.uk> References: <35AE6952.2D94C5E9@scee.sony.co.uk> <35AF91D1.CCE4F782@compuserve.com> NNTP-Posting-Host: camfw01.millennium.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en Nick Slaven wrote: > > It might be worth mentioning pre processor directives (I think thats the name). I use them in a similar way: If I've got Graphics.c which has globals that must be accessed by other modules, I do this: Graphics.c: #define _GRAPHICS_C #include "graphics.h" ... yadda yadda yadda ... Graphics.h #ifndef _GRAPHICS_C #define GRAPHICS_EXTERN extern #else #define GRAPHICS_EXTERN #endif GRAPHICS_EXTERN int banana; GRAPHICS_EXTERN int wibble; Thus, in Graphics.C, wibble and banana are defined without the 'extern' keyword, but if I include graphics.h in any other file, they are defined 'extern'. banana and wibble are not defined in Graphics.c, but graphics.h. I'm sure there must be a better way of doing this though. Cheers, James -- == James_Russell@scee.sony.co.uk +44 (171) 447-1626 == Developer Support Engineer - Sony Computer Entertainment Europe A student who changes the course of history is probably taking an exam.