Re: Porting W3Lib to Windows 3.x/Windows 95

>    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.

YEP - you said it! And thanks for a most useful mail!
 
>     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".

Eric also pointed that problem out. This is why you find a funny file open 
construct around line 546 in HTFile.c
 
> 
> Modifications made to the original W3Lib source code
> -----------------------------------------------------------------
> 
> 1.   In "tcp.h", watch out for the following lines if you're not
>       developing on the NT platform.
> 
> 
> #undef NETREAD
> #undef NETWRITE
> 
> #define NETREAD(s,b,l)  ((s) >= 10) ? recv((s),(b),(l),0) : read ((s),(b), (l))
> #define NETWRITE(s,b,l) ((s) >= 10) ? send((s),(b),(l),0) : write((s),(b), (l))
> 
> 
>      This is a major cause of system crash. Other symtoms  I've experienced
>      include: messed-up desktop display, warp mouse pointers.
> 
>      This conditional clause needs to be removed for proper socket 
>      use under Windows 3.x and Windows 95.

They are removed in the 4.0 release announced yesterday.

Thanks for the information, I have taken the liberty to add this mail to the 
page

	http://www.w3.org/pub/WWW/Library/User/Platform/Windows.html

so that people can find it again...


-- 

Henrik Frystyk Nielsen, <frystyk@w3.org>
World-Wide Web Consortium, MIT/LCS NE43-356
545 Technology Square, Cambridge MA 02139, USA

Received on Wednesday, 10 January 1996 19:46:01 UTC