Skip to Content.
Sympa Menu

freetds - Re: call to dberrhandle fails in dblib

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Mark J. Lilback" <mark AT lilback.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: call to dberrhandle fails in dblib
  • Date: Mon, 3 Sep 2001 22:25:35 -0500


At 9:44 PM +0200 9/3/01, Harald Fernengel wrote:
Hello,

in my dblib apps I'm using the following call:

dberrhandle( (EHANDLEFUNC)myErrHandler );

myErrHandler is a "extern C" function which works fine using the Sybase / M$
dblib. Unfortunately, this call fails using FreeTDS:

cannot convert `int (*)(DBPROCESS*, int, int, int, char*, char*)' to
`int(*)()' for argument `1' to `int (* dberrhandle(int (*)()))()'

in FreeTDS's sybdb.h dberrhandle is defined as follows:
extern int (*dberrhandle( int (*handler)() )) ();

in Sybase's Headers it is defined differently:
EHANDLEFUNC CS_PUBLIC dberrhandle PROTOTYPE((EHANDLEFUNC handler));

Change it in FreeTDS's sybdb.h to:

typedef int (*dberrhandle_func)(DBPROCESS *dbproc, int severity, int dberr,
int oserr, char *dberrstr, char *oserrstr);
typedef int (*dbmsghandle_func)(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity,
char *msgtext, char *srvname, char *procname, int line);
extern dberrhandle_func dberrhandler(dberrhandle_func handler);
extern dbmsghandle_func dbmsghandler(dbmsghandle_func handler);

It seems FreeTDS is generally compiled with non-strict compilers. To get it to work with Metrowerks CodeWarrior on Mac OS 9, I had to make a slew of changes like function prototypes, casts of unsigned chars to chars when strlen is called, etc.

--
__________________________________________________________________________
"The best assumption to have
Mark J. Lilback is that any commonly held
<mark AT lilback.com> belief is wrong." -- Ken Olsen,
http://www.lilback.com/ founder, Digital Equip. Corp.




Archive powered by MHonArc 2.6.24.

Top of Page