Re: Cross compilation, warnings and errors

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Mon, 24 Jan 2011 13:09:45 -0300
Luis Lavena <[email protected]> wrote:

> Thank you for your complete and thoughtful response, but seems there
> is a confusion.
> 
> Perhaps my english is not accurate, but what I pointed out is that
> during FreeTDS cross compilation I received the compilation error, not
> anything else.

There seems to be a rule on the Internet that anyone concerned that their English is unclear in fact writes perfectly clearly.  :-)

We're both a little confused.  I didn't realize bsqldb.c included sqlfront.h (it shouldn't).  

But, when I build bsqdb, I don't see the symbol redefinition problem on Linux, Win32, or Win64.  (The latter two built using Microsoft's compiler du jour.)  

> That means FreeTDS headers are not evaluating for missing or defined
> symbols prior to define their own.

Correct: LPCBYTE is defined unconditionally as a typedef.  Microsoft's sqlfront.h does the same thing.  I'm saying that's OK; if you have a symbol-redefinition error, it's better not to include the *other* definition.  This code would *not* be correct in sqlfront.h:

	#ifndef LPCBYTE
	#define LPCBYTE /* ... */
	#endif

because such code *assumes* the prior definition is equivalent to the one it would define itself.  That's not a safe assumption: LPCBYTE has no commonly recognized meaning; there's no guarantee that the prior definition conforms to FreeTDS's requirements.  

My advice, then:

1.  Substitute sybfront.h for sqlfront.h in src/apps/bsqldb.c.  I think that will fix the problem.  

2.  If not, look for a way to exclude unneeded defintions when including windows.h.  When using Microsoft's version, I define WINDOWS_LEAN_AND_MEAN before including windows.h.  What you'd need for mingw I don't know.  

HTH.  

--jkl
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.