Building Window DLLs
This is under rapid construction.
Please look at the User's Guide for more details.
The WWW Libraries for Windows may be build many ways. The builder must decide
on:
- Library Types: static vs dynamic
- Select Options: unix-style select vs WSAAsyncSelect
- Input/Output Options: windowed vs console
Library Types:
When building the LibWWW for Windows (3.x) or WIN32 (NT, 95), you have the option of creating
seperate DLLs with defined interfaces. This is reccomended for WIN32 builds and required for Win 3.x
due to boundry size problems.
static
The libraries may be build as one large static library. This is how libwww is implemented on Unix
platforms. Subsequent references to the various DLLs may all be assumed to refer to the staticly
linked libwww. Care has been taken to insure that there are no #define conflicts where one
library would want a #define that would interfere with the modules in other libraries. When
building a static library, see the following sections on Select Options and Input/Output Options, accumulate all the #defines that are required, and build
the whole libwww with those #defines.
Note - it is not recomended to staticly link
to the libraries if you are building a WIN16 application as it creates segment size problems.
dynamic
The libwww has been divided up into several dynamic link libraries. The boundries between these DLLs
are based on module interdependancy and some assumptions regarding which modules may be replaced by
the application. Unlike static linking, dynamic linking requires that all the modules in a DLL be
replaced at once. This is because the DLL needs all internal references to be resolved at build
time. Define WWW_WIN_DLL for all libraries that you are building as DLLs. This takes care of
dereferencing TTYPrint and WWW_TraceFlags.
list of DLLs
There are three basic libraries that you will need for any LibWWW application:
- wwwdll.dll
- wwwutils.dll
- wwwcore.dll
- wwwcache.dll
- wwwmime.dll
- wwwhttp.dll
- wwwmlgen.dll
- wwwrules.dll
- wwwnews.dll
- remaining modules
wwwdll.dll
The wwwdll library is a tiny library that contains a pointer to the TTYPrint function. When Windows loads a DLL, the exported function and data
pointers get "fixed up" in the other modules. Consequently, what may be a directly addressable
piece of data in it's home library will be a pointer in the other libraries and executables that
dynamically link to it. The TTYPrint pointer is exported to the other modules and referenced via
the TTYPrint macro in HTUtils.h. wwwdll.dll also contains the WWW_TraceFlag to the same end of macroing the
indirection. Dependencies: windll.c wwwdll.c wwwdll.def
wwwutils.dll
The utils are a set of basic utilies that are used by the other libraries and may prove usefull
outside the context of the libwww. It implements linked lists, associative arrays, ... See Util Modules for a description of the use of these
functions. Dependencies:
wwwdll.lib
windll.c
wwwutils.def
HTArray.c
HTAssoc.c
HTAtom.c
HTChunk.c
HTList.c
HTString.c
HTUU.c
wwwcore.dll
This library contains all the WWW specific functions needed to write an application that uses the
standard streams and converters, or produces it's own. See Core Modules for a description of the use of these
functions. Dependencies:
wwwdll.lib
wwwutils.lib
windll.c
wwwcore.def
HTAccess.c
HTAlert.c
HTAnchor.c
HTBind.c
HTConLen.c
HTDialog.c
HTDNS.c
HTError.c
HTEscape.c
HTEvntrg.c
HTFormat.c
HTFWrite.c
HTMethod.c
HTNet.c
HTParse.c
HTProt.c
HTReqMan.c
HTSocket.c
HTTCP.c
HTTee.c
HTWriter.c
HTWWWStr.c
wwwcache.dll
Dependencies:
wwwdll.lib
wwwutils.lib
windll.c
wwwcache.def
HTCache.c
wwwmime.dll
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
windll.c
wwwmime.def
HTBound.c
HTHeader.c
HTMIME.c
HTMIMERq.c
wwwhttp.dll
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
wwwcache.lib
wwwmime.lib
windll.c
wwwhttp.def
HTAABrow.c
HTAAUtil.c
HTAlert.c
HTTP.c
HTTPReq.c
wwwmlgen.dll
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
windll.c
wwwmlgen.def
HTMLGen.c
HTMLPDTD.c
wwwrules.dll
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
windll.c
wwwrules.def
HTProxy.c
HTRules.c
wwwnews.dll
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
wwwmime.lib
wwwmlgen.lib
wwwnews.lib
windll.c
wwwnews.def
HTNDir.c
HTNews.c
HTNewsLs.c
HTNewsRq.c
remaining modules
Not all the modules have been incorporated into DLLs yet. Therefore, it is
required that the application link directly to the remaining modules. In
addition to it's own source files, the application will have the remaining
Dependencies:
wwwdll.lib
wwwutils.lib
wwwcore.lib
wwwmime.lib
wwwhttp.lib
wwwmlgen.lib
wwwrules.lib
HTDir.c
HTFile.c
HTFTP.c
HTFTPDir.c
HTGopher.c
HTGuess.c
HTHist.c
HTHome.c
HTIcons.c
HTInit.c
HTLog.c
HTML.c
HTMulti.c
HTPlain.c
HTTelnet.c
HTTeXGen.c
HTWSRC.c
Make Files
MSVC2.2 Make files are available in the windows
directory. Each library is build from some .c files,
It is impoortant to build these libraries in the correct order. Observe the dependancies listed at
the end of each library description. The first dependancies are the lib files that were generated
when previous libraries were built.
Extra Modules for the DLLs
- windll.c - DLLMain to ALL DLLs.
- wwwdll.c - instances of PTTYPrint and WWW_TraceFlag. This is included in wwwdll so that
it can export the variables to the rest of the DLLs.
- wwwdll.def, wwwutils.def, wwwcore.def - def (exports) files for the DLLs of the same
names.
Exporting Functions
The functions exported from a DLL are listed in the EXPORTS section of a .def file. These can be
found in the windows directory. These may also be build by
the makeDefs.pl perl script.
makeDefs.pl
makeDefs.pl is a perl 4 script which takes a list of modules and generates a list of exports from
them. The module list may be taken from the appropriate header file for the library, eg
wwwutils.dll uses wwwutils.def which is made from WWWUtils.html. The file list
assumes nothing except the module file names with no extensions so each line that says:
#include "some file.h" should be translated to some file. As of the time of this
writing, there were to ways in which the library header files must be modified to give an accurate
list of the modules in a library.
in WWWCore.html, HTReq.h shoud tranlate to
HTReqMan
and in WWWUtils.html, HTUtils.h should be removed from the list.
Select Options:
The library is designed around the standard, unix-style, select call. The Winsock spec defines a
Windows specific extension called WSAAsyncSelct. Calling WSAAsyncSelect tells your Winsock.DLL to
pass messages to a window when I/O is ready on a socket.
unix-style select
This is the default mode for the compilation. All sockets are registered via HTEvent_Register. A
select call in HTEvent_Loop processes these registered sockets and dispatches the appropriate
handlers.
WSAAsyncSelect
HTEvent_Register calls WSAAsyncSelect to register the sockets. HTEvent_Loop is a standard Windows
event loop that dispatches the results of the AsyncSelect calls and, optionally, the windows
messages for the IO window. Define WWW_WIN_ASYNC in the wwwcore library to include WSAAsyncSelect logic.
Input/Output Options:
The IO has to go somewhere, right? In WIN32, there is a notion of a console
application. This means that all IO happens through a standard DOS shell interface, with a FILE
pointer like that in Unix. WIN16 users will have to use a Windows(r)(tm) window for IO. All the
libraries (except wwwdll.dll) make calls to TTYPrint. It is therefore important that all modules agree on whether they
are a console application or a windows application.
windowed
The HTBrowse.c file provides a main. However, as a window program, the LineMode browser needs a
LibMain. This is found in www.c. Three
other modules, scroll.c and lib.c provide the window for the application.
console
The console option is available only in WIN32. All io happens through the WIN32 console window. This
model stronly resembles the unix model. Define _CONSOLE for all libraries
Eric Prud'hommeaux, November 1995