Subject: Re: linking with ODBC library
From: [email-masked] (Henry Minsky)

16 Jan 1997 00:20:13 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
Original-CC: [email-masked]
In-reply-to: <[email-masked]> (message from Gunther Ebert on Wed, 15 Jan 1997 12:59:13 +0100)
Original-Sender: [email-masked]

   Date: Wed, 15 Jan 1997 12:59:13 +0100
   From: Gunther Ebert <[email-masked]>
   Cc: [email-masked]
   References: <[email-masked]>

   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
"[email-masked]" with one line of text: "help".