gcc4: extern inline vs. c99

Yaakov (Cygwin/X) yselkowitz@users.sourceforge.net
Thu Mar 26 01:29:00 GMT 2009


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



More information about the Cygwin mailing list