TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Wim Veldhuis
from: Dean Roddey
date: 1994-09-30 05:13:18
subject: Compile problem

Thanks Wim for your msg about Compile problem, on 26 09-26-1994

WV> 
WV>  HB> Basing all headers off  and then including the
WV>  HB> relavent parts via macros is one of the most horrible things
WV> 

Actually it has worked pretty good for me, but its because I just
built right along on the same type of structure. In my class
library, each .Dll has a main header through which all other
headers are included according to conditional tokens (a la the
toolkit.) But, since I have a fundamental header that all clients
would use, I include OS2.H there and only there. The user then
uses my conditional include tokens (instead of the OS/2 ones) and
I then force on what I need. So, by using this single entry point
approach, I assure that all tokens are defined before the first
time OS2.H is ever hit (as apposed to each header file including
the headers that it needs.)

So here is a sample from my lowest level .Dll, the main header:


//
___--------------------------------------------------------------------------
//  Do some expansions for lazy people //
___--------------------------------------------------------------------------
#if         defined(INCL_CIDLIB) #define     INCL_CIDLIB_CORE
#define     INCL_CIDLIB_ERRORS #define     INCL_CIDLIB_EXTENDED
#endif

#if         defined(INCL_CIDLIB_CORE)
#define     INCL_CIDLIB_CONTAINERS
#define     INCL_CIDLIB_DATETIME
#define     INCL_CIDLIB_FACOBJECT
#define     INCL_CIDLIB_FILES
#define     INCL_CIDLIB_FILESYS
#define     INCL_CIDLIB_SEMAPHORES
#define     INCL_CIDLIB_STREAMS
#endif

#if         defined(INCL_CIDLIB_CONTAINERS)
#define     INCL_CIDLIB_BAGS
#define     INCL_CIDLIB_LINKLISTS
#define     INCL_CIDLIB_STACKS
#endif

#if         defined(INCL_CIDLIB_ERRORS)
#define     INCL_CIDLIB_ERROBJS
#define     INCL_CIDLIB_ERRORIDS
#endif

#if         defined(INCL_CIDLIB_EXTENDED)
#define     INCL_CIDLIB_MEMORY
#define     INCL_CIDLIB_METRICS
#define     INCL_CIDLIB_PROCREGISTRY
#define     INCL_CIDLIB_RANGES
#endif

#if         defined(INCL_CIDLIB_FILES)
#define     INCL_CIDLIB_BINFILES
#define     INCL_CIDLIB_INIFILES
#define     INCL_CIDLIB_PATHSTRS
#define     INCL_CIDLIB_TEXTFILES
#endif


//
___--------------------------------------------------------------------------
//  Force on stuff in this facility that must go with other
things. Most of //  these are done below, but some have to be done
before the include section //  in order to work correctly. //
___--------------------------------------------------------------------------
#if         defined(INCL_CIDLIB_FILESYS)        \
            || defined(INCL_CIDLIB_BAGS)        \
            || defined(INCL_CIDLIB_STACKS)
#define     INCL_CIDLIB_LINKLISTS
#endif


//
___--------------------------------------------------------------------------
//  Force on any needed OS/2 stuff. In order to know what we need
to force on, //  we have to know what CIDLib include tokens are
defined, so handle expanding //  the INCL_CIDLIB token (if it is
defined) before making the decision. Once //  we know the CIDLib
includes, we can force the needed OS/2 stuff on. //
___--------------------------------------------------------------------------
#if         defined(INCL_CIDLIB_FILESYS)        \
            || defined(INCL_CIDLIB_DATETIME)
#define     INCL_DOSFILEMGR
#endif

#if         defined(INCL_CIDLIB_SEMAPHORES)
#define     INCL_DOSSEMAPHORES
#endif

// Force some stuff on all the time
#define     INCL_DOSPROCESS

// Now include the OS/2 header
#include    


//
___--------------------------------------------------------------------------
//  If memory is included, then include the runtime memory header
so that the //  inlines used to map the runtime names will work. //
___--------------------------------------------------------------------------
#if         defined(INCL_CIDLIB_MEMORY) #include    
#endif



//
___--------------------------------------------------------------------------
//  Include all of the public source module headers. These
includes are in the //  correct order of dependency so that the
client application does not need //  to worry about it. Inclusion
of some of the headers is controlled by //  conditional compilation
tokens. //
___--------------------------------------------------------------------------
#include    "CIDLib_Type.Hpp" #include    "CIDLib_DevMacros.Hpp"
#include    "CIDLib_Object.Hpp" #include    "CIDLib_Base.Hpp"
#include    "CIDLib_Numeric.Hpp" #include    "CIDLib_String.Hpp"
#include    "CIDLib_String2.Hpp"

#if         defined(INCL_CIDLIB_ERRORIDS)
#include    "CIDLib_ErrorIds.Hpp"
#endif

#if         defined(INCL_CIDLIB_ERROBJS)
#include    "CIDLib_Error.Hpp"
#endif

#if         defined(INCL_CIDLIB_LINKLISTS)
#include    "CIDLib_Container.Hpp"
#endif

#if         defined(INCL_CIDLIB_LINKLISTS)
#include    "CIDLib_LLst.Hpp"
#endif

#if         defined(INCL_CIDLIB_BAGS)
#include    "CIDLib_Bag.Hpp"
#endif

#if         defined(INCL_CIDLIB_STACKS)
#include    "CIDLib_Stack.Hpp"
#endif

#if         defined(INCL_CIDLIB_DATETIME)       \
            || defined(INCL_CIDLIB_FILESYS)
#include    "CIDLib_DateTime.Hpp"
#endif

// If any files are on, then include path strings
#if         defined(INCL_CIDLIB_PATHSTRS)       \
            || defined(INCL_CIDLIB_FILESYS)     \
            || defined(INCL_CIDLIB_BINFILES)    \
            || defined(INCL_CIDLIB_INIFILES)    \
            || defined(INCL_CIDLIB_TEXTFILES)
#include    "CIDLib_PathStr.Hpp"
#endif

//
//  Include the stream classes if any of the modules that
//  derive from it are included.
//
#if         defined(INCL_CIDLIB_STREAMS)        \
            || defined(INCL_CIDLIB_BINFILES)    \
            || defined(INCL_CIDLIB_MEMORY)
#include    "CIDLib_Stream.Hpp"
#include    "CIDLib_StreamParser.Hpp"
#endif

// If any files are on, then we need the base file classes
#if         defined(INCL_CIDLIB_BINFILES)       \
            || defined(INCL_CIDLIB_TEXTFILES)
#include    "CIDLib_FileBase.Hpp"
#endif

#if         defined(INCL_CIDLIB_BINFILES)
#include    "CIDLib_BinFile.Hpp"
#endif

#if         defined(INCL_CIDLIB_INIFILES)
//#include    "CIDLib_INIFile.Hpp"
#endif

#if         defined(INCL_CIDLIB_TEXTFILES)
#include    "CIDLib_TextFile.Hpp"
#endif

#if         defined(INCL_CIDLIB_FILESYS)
#include    "CIDLib_FileSys.Hpp"
#endif

// Include memory buffer support
#if         defined(INCL_CIDLIB_MEMORY)
#include    "CIDLib_Memory.Hpp"
#endif

// Include the little range class
#if         defined(INCL_CIDLIB_RANGES)
#include    "CIDLib_Range.Hpp"
#endif

#if         defined(INCL_CIDLIB_SEMAPHORES)
#include    "CIDLib_Semaphore.Hpp"
#endif

// Include the metrics and process registry stuff
#if            defined(INCL_CIDLIB_METRICS)
#include    "CIDLib_Metrics.Hpp"
#endif

#if         defined(INCL_CIDLIB_PROCREGISTRY)
#include    "CIDLib_ProcRegistry.Hpp"
#endif

// These are always on
#include    "CIDLib_Process.Hpp"
#include    "CIDLib_Facility.Hpp"


// Include the facility object
#if         defined(INCL_CIDLIB_FACOBJECT)
#include    "CIDLib_ThisFac.Hpp"
#endif


//
___--------------------------------------------------------------------------
//  Avoid multiple inclusion of this portion of the header //
___--------------------------------------------------------------------------
#if         !defined(CIDLIB_HPP) #define     CIDLIB_HPP


//
___--------------------------------------------------------------------------
//  The client program defines the CIDLIB_MAINMODULE toke, which
causes this //  to be included. The main just calls our init
method, i4CIDLib_Init() and //  passes the command line parms. //
___--------------------------------------------------------------------------
#if     defined(CIDLIB_MAINMODULE) extern  tCIDLib::INT4
i4CIDLib_Init(int, char**); int     main(int ArgC, char **ArgV) {
    return i4CIDLib_Init(ArgC, ArgV);
}
#endif

The same process continues for each level of .Dll. The big
difference though is that I done turn on separate portions of one
1 file via different tokens. I turn on whole files at a time. This
limits the effects of header dependencies which can grow
horrendous under C++ if you're not careful.

Hope this helps.

___
 X KWQ/2 1.2b X This tagline stolen by KWQ Mail/2.

--- Maximus/2 2.01wb

* Origin: Fernwood - your source for OS/2 files! (1:141/209)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 712/353 623 713/888 800/1
@PATH: 141/209 270/101 396/1 3615/50 229/2 12/2442 711/409 54/54 711/808 809
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.