Skip to Content.
Sympa Menu

freetds - Re: [freetds] Windows compile not working

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Linus <Linus AT mccabe.nu>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Windows compile not working
  • Date: Wed, 10 Sep 2003 23:05:30 +0200


Hello again!

I'm happy to inform you that I got freetds to work, compiled with MinGW!

After trying various changes here and there, I realized there was no call to
WSAStartup(), a call necessary for winsock to initialize sockets before use.
I'm not sure why freetds works with MSVC when this call is not there..!?

Anyway, I also had to make a few hacks here and there to get it to work, most
of them might not be suitable to add to freetds' code without changes. This
was all done to CVS version from a few days ago.

* First I had to replace FreeTDS/libtool with the one from the MingW/MSys
package.

* I had to remove the line definition of BOOL from sybdb.h, line ~138 :
#ifndef __MINGW__
typedef unsigned char bool;
#endof

* I had to add -lws2_32 to LIBS in makefiles src/apps/Makefile and
src/pool/Makefile.

* #ifdef gettimeofday around the timing in tsql.c:

#ifdef gettimeofday
if (opt_flags & OPT_TIMER) {
gettimeofday(&start, NULL);
print_rows = 0;
}
#endif
(also further down in the file where its used again)

* In the same file, where getpass is used:
#ifdef getpass
char *tmp = getpass("Password: ");

password = strdup(tmp);
#else
fprintf(stderr, "Missing argument -P \n");
tsql_print_usage(argv[0]);
exit(1);
#endif

(This is obviously no good solution ;)

* Last and worst, I had to add:
#define _OLEAUTO_H
in the top of freebcp.h. Otherwise I got conflicts on PARAMDATA.


I realize some of these changes are not perfect, but they might give some
hints whats needed to be done.

I could look into some of these changes more if you'd like, but I'm by no
means a MinGW expert - I merely want my xplatform program to work on win as
well..

/linus




On Monday 08 September 2003 04.45, James K. Lowden wrote:
> On Sun, 7 Sep 2003 20:43:50 +0200, Linus <Linus AT mccabe.nu> wrote:
> > > Anyway, until I hear from you again, Ill try focusing on the invalid
> > > argument to select() and see if I can figure out where that comes from
> > > and if that might be the cause of my problems...
> >
> > Here I meant "socket()", of course, and after doing a bit more of
> > debugging, this is indeed where tds fails. socket() return "22", invalid
> > argument, but i cannot see why. The defines supplied are indeed what
> > they should be.
>
> In case it's any consolation, everything you're saying is consistent. The
> socket(2) call is returning an error, and the log file shows no packets
> sent. :-/
>
> One question might be, how is mingw different from VC++ wrt socket(2)?
> Does mingw introduce its own socket() function? Or does config.h not
> indicate you're building on a Win32 platform? I think the problem lies in
> that vicinity, because we have working VC++ builds.
>
> HTH. I'd be happy to see mingw added to our list of working compilers.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page