Compilation on Windows

I have been working with the W3lib on the 16/32-bit Windows platform for a couple of months now and would like to share some of the important considerations I discovered along the way. Hope this would prevent others from running into the same wall(s) and encourage more sharing of the W3Lib's Windows port.

These notes are by no means complete, just some which I've deemed important enough to be written down every now and then.

Compiling W3Lib into 16-bit DLLs

  1. Make sure the Windows prolog/epilog code is generated for functions where global variables of the DLL are referenced.
  2. Can't share a file pointer between different DLLs as the C Run-Time routines are linked individually into the DLLs. I'm not sure if there's a DLL version of the C Run-Time library (available in VC++ 2.x) which can resolve this problem.
  3. I recommend compiling using a Huge model and replacing malloc() with the GlobalAllocPtr macro.
  4. You will probably face the problem of "too many segments" if you try to build the whole library into a single DLL.

Compiling W3Lib into 32-bit DLLs

  1. I/O file handles cannot be shared between different DLLs unless they are linked with the DLL version of the C Run-Time Library.
        i.e.    if function A of DLL X do an "fopen", it cannot call 
                function B of DLL Y to do subsequent "fread".
    

Modifications made to the original W3Lib source code

Cheers,
Kok Hoon
-----------------------------------------------------------
M.A.P.S.                   Information Technology Institute
-----------------------------------------------------------