[freetds] _tds_socket_init

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Fri Jan 11 02:37:11 EST 2008


> 
> _tds_socket_init and _tds_socket_done are defined in 
> tds/net.c and used
> nowhere.  
> 

Are used in a macro in include/tds_sysdep_private.h which is used in
tsql.c for instance.

> According to Microsoft's Win32 documentation, they should be called,
> because "WSAStartup ... *must* be the first Windows Sockets function
> called...." and WSACleanup must be the last one called.  
> 
> To support Win32 correctly, these functions should be added 
> to some kind
> of tds_init() function that would be called by dbinit() and 
> friends.  It
> can't be called at connect time (unless we keep track with a 
> global static
> or something), because a process may create more than one 
> connection.  
> 
> Another option is to do the same work in the .dll when it 
> initializes. 
> That's actually much more desirable, ISTM, unless we support 
> static Win32
> libraries. 
> 

Yes, see win32/initnet.c which contains the "main" for DLLs.

> If we're not going to bother using these functions, we should probably
> delete them.  
> 

freddy77



More information about the FreeTDS mailing list