[unixODBC-dev] ODBC on 64 bit linux - test64

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Tue Jan 22 15:21:05 GMT 2008


 
> 
> ZIGLIO, Frediano, VF-IT wrote:
> 
> >>> 
> >>>
> >>>      
> >>>
> >>Why? the type in issue is the integer, I don't see why the 
> size of a 
> >>pointer has anything to do with it. What about a platform 
> >>with a 64bit 
> >>accumulator and a 48 bit address bus?
> >>
> >>    
> >>
> >
> >The header you use is not fully compatible with Windows. Under win64
> >sizeof(long) == 4 but sizeof(SQLULEN) == 8. Perhaps a more compatible
> >way is defining SQLULEN as a size_t type.
> >
> >  
> >
> Well, sizeof( long ) = 4 is the original cause of the 
> confusion. I agree 
> that its broken on windows, but alternative header files are 
> available 
> for that platform :-).
> 
> >>> 
> >>>
> >Yes and not cause when customers wants to move to win64 code is not
> >compatible. Currently some Linux x64 distro use sizeof(SQLULEN) == 4
> >while others use sizeof(SQLULEN) == 8. Personally I don't 
> like this ABI
> >incompatibility. It cause closed source drivers to have 2 compiled
> >shared libraries.
> >
> >  
> >
> Tell me about it :-(
> 

Both use unixODBC 2.2.11 but Debian/Ubuntu have this patch

--- unixodbc-2.2.11.orig/include/sqltypes.h
+++ unixodbc-2.2.11/include/sqltypes.h
@@ -150,6 +150,16 @@
  * 
  */
 
+/*
+ * Failing to define this is *absolutely* broken on 64-bit archs, and
we
+ * are setting it in the Debian build, so use of this ABI is mandatory.
+ * If you don't like it, go build your own non-64-bit-clean library
instead.
+ * SRL 2006-03-04
+ */
+#ifndef BUILD_REAL_64_BIT_MODE
+#define BUILD_REAL_64_BIT_MODE
+#endif
+
 #if (SIZEOF_LONG == 8)
 #ifndef BUILD_REAL_64_BIT_MODE
 typedef int             SQLINTEGER;
--- unixodbc-2.2.11.orig/include/sqlext.h
+++ unixodbc-2.2.11/include/sqlext.h
@@ -524,7 +524,7 @@
 #define SQL_C_USHORT     (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED
SMALLINT*/
 #define SQL_C_UTINYINT   (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED
TINYINT*/
 
-#if (ODBCVER >= 0x0300) && (SIZEOF_LONG == 8) &&
defined(DO_YOU_KNOW_WHAT_YOUR_ARE_DOING)
+#if (ODBCVER >= 0x0300) && (SIZEOF_LONG == 8) &&
defined(BUILD_REAL_64_BIT_MODE)
 #define SQL_C_BOOKMARK   SQL_C_UBIGINT                     /* BOOKMARK
*/
 #else
 #define SQL_C_BOOKMARK   SQL_C_ULONG                       /* BOOKMARK
*/
@@ -1889,8 +1889,8 @@
 
 SQLRETURN SQL_API SQLParamOptions(
     SQLHSTMT           hstmt,
-    SQLUINTEGER        crow,
-    SQLUINTEGER 	  *pirow);
+    SQLULEN        	   crow,
+    SQLULEN 	  	   *pirow);
 
 SQLRETURN SQL_API SQLPrimaryKeys(
     SQLHSTMT           hstmt,

so it use BUILD_REAL_64_BIT_MODE by default which means 64bit on LP64
platforms (that is on Linux x64)

Frediano Ziglio



More information about the unixODBC-dev mailing list