delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/16/00:20:13

From: hqm AT ua DOT com (Henry Minsky)
Subject: Re: linking with ODBC library
16 Jan 1997 00:20:13 -0800 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199701160729.XAA00954.cygnus.gnu-win32@teller.datawave.net>
Original-To: gunther DOT ebert AT ixos-leipzig DOT de
Original-CC: gnu-win32 AT cygnus DOT com
In-reply-to: <32DCC691.2174@ixos-leipzig.de> (message from Gunther Ebert on Wed, 15 Jan 1997 12:59:13 +0100)
Original-Sender: owner-gnu-win32 AT cygnus DOT com

   Date: Wed, 15 Jan 1997 12:59:13 +0100
   From: Gunther Ebert <gunther DOT ebert AT ixos-leipzig DOT de>
   Cc: gnu-win32 AT cygnus DOT com
   References: <199701150732 DOT XAA27484 AT teller DOT datawave DOT net>

   Hi,

   it looks like the function prototypes for the ODBC functions are 
   missing or incorrect. Please check your header files if the 
   prototypes are there and if
   - all functions are declared as _stdcall (_stdcall is hidden in
     the WINAPI or STDCALL macros), that means your prototypes have
     to look like 
     int WINAPI func();
     You have to do this because the name mangling of _stdcall functions
     is different from the one of 'normal' functions.
   - there are no parameter types used which are smaller than 4 bytes
     because all Win32 API function parameters have to be dword-aligned
     and gcc doesn't do this automatically.
     Bad prototype:
     int WINAPI func(WORD param);
     Good prototype:
     int WINAPI func(DWORD param);
     You have to change all Win32 API parameter types which are smaller 
     than 4 bytes to DWORD even if the parameter types are actually CHAR 
     or WORD.
     You have to care about this because the total number of bytes passed
   as
     parameters to a Win32 API function is part of the name mangling of 
     these functions.

   Gunther


Yes, that was the problem, thanks! 

The ODBC include files which came with the Microsoft Visual C++
compiler were actually OK (although they have some redudant #defines
with the <windows.h> file), as long as I made sure to set -DWIN32 as a
compiler flag. The sqltypes.h file has a #define in it to
conditionally define SQL_API as __stdcall. SQL_API was the type
declared for all the ODBC functions in sql.h and sqlext.h.


Henry
-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019