W3C home > Mailing lists > Public > www-lib@w3.org > October to December 1995

Porting W3Lib to Windows 3.x/Windows 95

From: <kokhoon@iti.gov.sg>
Date: Tue, 26 Dec 1995 10:18:04 +0800
Message-Id: <9512260218.AA06250@iti.gov.sg>
To: www-lib@w3.org
Merry X'mas folks,

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

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.

2.   "sscanf" does not work in 16-bit DLLs. Replacement code has to 
     be supplied. I recomment using "atoi" & "atof" where possible.





Cheers,
Kok Hoon
-----------------------------------------------------------
M.A.P.S.                   Information Technology Institute
-----------------------------------------------------------
Received on Monday, 25 December 1995 21:19:52 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:25 GMT