Skip to Content.
Sympa Menu

freetds - [freetds] ODBC on 64 bit linux fix.

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: christos AT zoulas.com (Christos Zoulas)
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] ODBC on 64 bit linux fix.
  • Date: Thu, 17 Jan 2008 14:25:24 -0500


Here's a simple fix to make ODBC work on 64 bit machines. For those
unfamiliar with the problem, in 32 bit machines sizeof(pointer) ==
sizeof(int) and by definition some ODBC types are ints. At the same
time 2 ODBC routines assume that they can cast from pointer to int
and back. Linux provides the DO_YOU_KNOW_WHAT_YOUR_ARE_DOING macro
to fix the problem on 64 bit machines. If you use this macro to
compile FreeTDS you'll need to compile the client code with that.
This patch enables the macro and also fixes an inconsistency in an
ODBC function declaration.

YMMV,

christos

--- freetds-0.83.dev.20080117/configure.ac 2008-01-11 07:43:39.000000000
-0500
+++ freetds-0.83.dev.20080117.new/configure.ac 2008-01-17 12:38:35.539382636
-0500
@@ -242,6 +242,7 @@
#ifdef HAVE_WCHAR_H
#include <wchar.h>
#endif])
+AC_DEFINE(DO_YOU_KNOW_WHAT_YOUR_ARE_DOING, 1, [Hack for 64 bit ODBC])

case 2 in
$ac_cv_sizeof_short) tds_sysdep_int16_type=short;;
diff -ru freetds-0.83.dev.20080117/include/config.h.in
freetds-0.83.dev.20080117.new/include/config.h.in
--- freetds-0.83.dev.20080117/include/config.h.in 2008-01-17
04:16:32.000000000 -0500
+++ freetds-0.83.dev.20080117.new/include/config.h.in 2008-01-17
12:39:08.879655240 -0500
@@ -3,6 +3,9 @@
/* Define to 1 if you need BSD_COMP defined to get FIONBIO defined. */
#undef BSD_COMP

+/* Hack for 64 bit ODBC */
+#undef DO_YOU_KNOW_WHAT_YOUR_ARE_DOING
+
/* Define to enable work in progress code */
#undef ENABLE_DEVELOPING

--- freetds-0.83.dev.20080117/src/odbc/odbc.c 2008-01-14 14:21:06.000000000
-0500
+++ freetds-0.83.dev.20080117.new/src/odbc/odbc.c 2008-01-17
14:17:42.599842492 -0500
@@ -791,7 +791,7 @@
}

SQLRETURN ODBC_API
-SQLParamOptions(SQLHSTMT hstmt, SQLULEN crow, SQLULEN FAR * pirow)
+SQLParamOptions(SQLHSTMT hstmt, SQLUINTEGER crow, SQLUINTEGER FAR * pirow)
{
SQLRETURN res;





Archive powered by MHonArc 2.6.24.

Top of Page