Re: Cross compilation, warnings and errors

Luis Lavena <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
On Tue, Jan 25, 2011 at 2:34 AM, James K. Lowden <[email protected]> wrote:
> On Mon, 24 Jan 2011 13:09:45 -0300
> Luis Lavena <[email protected]> wrote:
>
>> 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).
>

Thank you, the thing is that I'm not a native english speaker, so
sometimes I fail to express in words my thoughts about one specific
problem.

That happen to me in the past, so sometimes I double check ;-)

> 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.)
>

Asked about this to mingw-w64 project, which is the one exposing this issue:

https://sourceforge.net/mailarchive/forum.php?thread_name=AANLkTinuvHqhFFZAJCXfQe_D2Et67jO9Q5%2BZZfUWMf1B%40mail.gmail.com&forum_name=mingw-w64-public

winscard.h is not present in mingw.org compiler, so that is why
LPCBYTE is not defined.

>
> 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.
>

I wish there was a modern VCS (Subversion at least) so I can provide
patches to this :'(

Thank you again for your time and your responses.
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
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.