xt_connlimit 20070707 kernel

Jan Engelhardt jengelh at computergmbh.de
Fri Jul 13 17:01:11 CEST 2007


On Jul 13 2007 23:18, Yasuyuki KOZAKAI wrote:
>
>> +static __attribute__((constructor)) void libipt_connlimit_init(void)
>> +{
>> +	register_match(&connlimit_reg);
>> +}
>
>JFYI: I've fixed compile error in the case of NO_SHARED_LIBS=1. The
>function name for initialization needs to be _init, not
>libipt_connlimit_init.

Uhm, that's why there is __attribute__((constructor)). Because *having* an
_init in a shared library has often failed on me. Example:


$ cat test.c
#include <stdio.h>
void _init(void)
{
        printf("Hello world\n");
}

$ cc test.c -shared -o test.so -Wall
/tmp/ccBDCmOL.o: In function `_init':
test.c:(.text+0x0): multiple definition of `_init'
/usr/lib/gcc/i586-suse-linux/4.1.2/../../../crti.o:/usr/src/packages/BUILD/glibc-2.5/cc-nptl/csu/crti.S:36:
first defined here
collect2: ld returned 1 exit status


And I certainly do not want to build without the GNU runtime,
because that makes things a bit more unportable (trying to
get the right linker switch, for ex.)




	Jan
-- 



More information about the netfilter-devel mailing list