Using the W3C Reference Library

# Application Specific Core Modules

We have now almost finised the description of the W3C Reference Core - we only need the last module which we will describe in this section. The module is called HTAlert and it contains the functionality for prompting the user for feedback or for reporting messages from the Library. As mentioned many times in this guide, the Library has been designed to be as portable as possible. This means that the actual implementation of this module is very simple and does only use ANSI C I/O functions. However, the can be overridden by more complex applications, for example using a GUI window manager.

The Alert module is a part of the core as the rest of the core files depend on it. Hence the definition of the module must be provided either by the internal or an external definition. A C Library module can be overriding by redefining all external references (normally declared in the include file) by new definitions in an application module. By doing this the linker takes the new definition of the module instead of the Library version and links it into the final executable file. The declaration (the include file) stays the same, but the definition has changed. The application module does not need to be called the same as the Library module, only the external references. External references are both global variables and public functions visible to other modules. As an example, the following module:

    	/* Library.c */
    	char GlobalFlag;
    	int GlobalFunction(void)
    	{
    		/* Library Implementation */
    	}

with the declaration file:

    	/* Library.h */
    	extern char GlobalFlag;
    	extern int GlobalFunction(void);

can get a new definition module

    	/* Application.c */
    	char GlobalFlag;
    	int GlobalFunction(void)
    	{
    		/* Application Implementation */
    	}

which will then be linked into the executable program. By using this method, the application can easily provide its own user interface (if any) and still be able to use the Library.