This is the mail archive of the
cygwin
mailing list for the Cygwin project.
gcc4: extern inline vs. c99
- From: "Yaakov (Cygwin/X)" <yselkowitz at users dot sourceforge dot net>
- To: cygwin at cygwin dot com
- Date: Wed, 25 Mar 2009 19:00:28 -0500
- Subject: gcc4: extern inline vs. c99
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Dave,
gcc-4 -std=c99 appears to be treating extern inline functions as if they
were marked dllexport, leading to all sorts of linking problems. STC:
$ cat > test-ntohs1.c <<EOF
#include <netinet/in.h>
extern void foo (uint32_t);
int main(void) {
uint32_t a = 10;
htonl(a);
foo(a);
return 0;
}
EOF
$ cat > test-ntohs2.c <<EOF
#include <netinet/in.h>
void foo(uint32_t i) {
htonl(i);
}
EOF
$ gcc-4 -o test-ntohs.exe test-ntohs1.c test-ntohs2.c
$ gcc-4 -std=c99 -o test-ntohs.exe test-ntohs1.c test-ntohs2.c
/var/tmp/ccUwNnD4.o:test-ntohs2.c:(.text+0x0): multiple definition of
`___ntohl'
/var/tmp/ccise4Pi.o:test-ntohs1.c:(.text+0x0): first defined here
/var/tmp/ccUwNnD4.o:test-ntohs2.c:(.text+0x15): multiple definition of
`___ntohs'
/var/tmp/ccise4Pi.o:test-ntohs1.c:(.text+0x15): first defined here
collect2: ld returned 1 exit status
Yaakov
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEAREIAAYFAknKxZwACgkQpiWmPGlmQSNL+wCgua1JV2lEwh9wCy1IzKztaBjL
uEwAnioFrNpd0IpIKa/MhnMPcNyUgzmQ
=drUK
-----END PGP SIGNATURE-----
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/