[freetds] freetds and windows

Brett generica at email.com
Sat Apr 9 17:59:16 EDT 2005




On Sat, 9 Apr 2005, James K. Lowden wrote:

> Brett <generica at email.com> wrote:
>>
>> Using dblib, I got the client program working perfectly.  It could talk
>> to the ms sql server, get the results back, and work as I'd hoped.
>>
>> The next plan was to compile it under windows, which I thought would be
>> straightforward.  We already had the system compiling under windows,
>> with faked calls for the sql stuff, so it was just a case of using the
>> freetds code, and linking it in with the windows libraries.
>
> Ah, but it is not straightforward. :-(  As you found, the VC++ project in
> the win32 directory builds the ODBC driver only.  If you update it to
> build db-lib, I would be glad to include your version in the main
> distribution.
>

So does that mean, in it's current state, this won't work under windows ?

>> I went into the win32 directory, used msvc to load the projects, and
>> compiled dblib.lib and libTDS.lib ... compiled and linked those into our
>>
>> software ( also had to link shell32.lib, due to some unresolved symbols
>> )
>
> shell32.lib?  That's a surprise.  What does db-lib need from that?
>

from memory, something about finding a filename's path from desktop, or 
some odd windows function.

>> Went to run it, and with the aid of printfs, found that it initialised
>> the library fine, but at the following call, it just terminates
>>
>> erc = dbsqlsend(dbproc);
>
> The function is provided by dblib.c:
>
> $ cd build/src/dblib/.libs
> $ file * |grep ELF | awk -F: '{print $1}' |xargs nm -o |grep dbsqlsend
> dblib.o:00006f68 T dbsqlsend
> libsybdb.so.5.0:0000ec5c T dbsqlsend
>
> Can you run your test in the debugger and find out where it dies?  Does
> TDSDUMP tell you anything?  If the process dies sending the login packet,
> try TDSVER=4.2.  TDS 4.2 login packets are logged by TDSDUMP, so you
> should at least see that much in your log.
>

I've never had any luck debugging this program, since it is not 
straightforward c, but a mix of c and prolog, compiled by a prolog 
compiler into an executable.  Generally debuggers 'just don't work' with 
it :(

I'll try some dumping and see what that shows

thanks,

 	/ Brett



More information about the FreeTDS mailing list