diff: odbc.m: gcc & MS odbc header files

Fergus Henderson fjh at hydra.cs.mu.oz.au
Wed Oct 8 16:38:48 AEST 1997


Hi,

Simon, can you please review this change?

extras/odbc/odbc.m:
	Add a definition for __stdcall so that the Microsoft ODBC
	headers will compile under gcc with fewer patches.

cvs diff: Diffing .
Index: odbc.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/extras/odbc/odbc.m,v
retrieving revision 1.3
diff -u -u -r1.3 odbc.m
--- odbc.m	1997/10/08 02:18:22	1.3
+++ odbc.m	1997/10/08 06:35:58
@@ -24,24 +24,19 @@
 %
 % 	Binary data is converted to a string of hexadecimal digits.
 %
-%	This requires a compilation grade with conservative garbage 
+%	This module requires a compilation grade with conservative garbage 
 % 	collection. Any grade containing .gc in its name, such as asm_fast.gc,
 %	will do. See the section "Compilation model options" in the Mercury
 %	User's Guide for more information.
 %
-%
 % 	The header files distributed with the Microsoft ODBC SDK require
-% 	some modification for compilation with gcc. For legal reasons a 
-%	patch cannot be included in the Mercury distribution.
-%
-%	In particular, the line
-% 		#define SQL_API		__attribute__ ((stdcall))
-%	must be added to sqltypes.h in place of the existing definition
-%	of SQL_API.
-%
-% 	Also some C++ style comments and some typedef conflicts must be 
-%	removed from some of the header files. The error messages should 
-%	make it obvious which ones. 
+% 	some modification for compilation with gcc.  In particular,
+% 	some conflicting typedefs for SQLUINTEGER and SQLSCHAR must be
+% 	removed from sql_types.h.
+% 	(For legal reasons a patch cannot be included in the Mercury
+% 	distribution.)
+%	The Microsoft ODBC header files also use some C++ style comments,
+%	so you need to use the `--no-ansi' option to mgnuc.
 %
 % To do:
 %
@@ -331,6 +326,19 @@
 	** functionality but compiles with the ODBC 3.0 header files.
 	*/
 #define ODBC_VER 0x0250
+
+/*
+** The following is needed to allow the Microsoft headers to
+** compile with GNU C under gnu-win32.
+*/
+
+#if defined(__GNUC__) && !defined(__stdcall)
+  #define __stdcall __attribute__((stdcall))
+#endif
+
+#if defined(__CYGWIN32__) && !defined(WIN32)
+  #define WIN32 1
+#endif
 
 #include <windows.h>
 #include ""sql.h""

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list