[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ltdl, -ansi compiler flag and windows host
From: |
Roumen Petrov |
Subject: |
Re: ltdl, -ansi compiler flag and windows host |
Date: |
Sun, 15 Nov 2009 16:04:05 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.23) Gecko/20090907 SeaMonkey/1.1.18 |
Ralf Wildenhues wrote:
Hello Roumen,
* Roumen Petrov wrote on Sun, Nov 15, 2009 at 01:39:03PM CET:
The modification of lt_private .h is result of this discussion
http://www.mail-archive.com/address@hidden/msg02530.html
Actually, I don't know why I added that "|| __STRICT_ANSI__" there at
all. I'm hesitant to change it without knowing though.
You should be able to work around this issue with adding something like
this to your CPPFLAGS (untested):
'-D__attribute__(X)=__attribute__(X)'
Cheers,
Ralf
Test case:
========================================
#include <windows.h>
#ifndef __attribute__
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) ||
__STRICT_ANSI__
# define __attribute__(x)
# endif
#endif
#ifndef LT__UNUSED
# define LT__UNUSED __attribute__ ((__unused__))
#endif
extern int __declspec(dllimport) lt_foo LT__UNUSED;
static int foo() {
LoadLibrary("foo");
return(0);
}
========================================
Results:
1)
--------------
$ ....-mingw...-gcc -Wall -c test-ansi.c -E
'-D__attribute__(X)=__attribute__(X)' | tail -6
extern int __attribute__((dllimport)) lt_foo __attribute__ ((__unused__));
static int foo() {
LoadLibraryA("foo");
return(0);
}
--------------
2)
--------------
$ ....-mingw...-gcc -Wall -c test-ansi.c -E
'-D__attribute__(X)=__attribute__(X)' -ansi | tail -6
extern int lt_foo ;
static int foo() {
LoadLibraryA("foo");
return(0);
}
--------------
In case 2) with lowercase X result is same variable lost dllimport
attribute.
What about to modify lt__private.h to ?
=========================
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
# define __attribute__(x)
#endif
#ifndef LT__UNUSED
# ifndef __STRICT_ANSI__
# define LT__UNUSED __attribute__ ((__unused__))
# else
# define LT__UNUSED
# endif
#endif
=========================
I can't test as the oldest my compiler is gcc 2.95.3 where attribute is
supported.
Roumen