A
Andrew Slade
Hello,
I am making calls from one compilation unit to functions in another by
pointers and I get the warnings below from gcc on 2.4.x Debian Linux. The
executable seems to work fine but the warnings bothers me a lot, mostly
because I don't understand what I did wrong. The code I used I got from the
FAQ on the matter, question 4.12.
"warning: passing arg 2 of `hash_emumerate' from incompatible pointer type"
"warning: passing arg 2 of `hash_free_table' from incompatible pointer
type"
Compilation unit that is calling, stub.o
{
..
int printer(char *, void *data), (*printer_p)( char *, void *) = printer;
int strfree( void *d ), (*strfree_p)( void * ) = strfree;
..
hash_enumerate( &table, printer_p);
..
hash_free_table( &table, strfree_p )
}
================================================
Compilation unit that is being called, hash.o:
void hash_free_table( hash_table *table, void (*func)(void *) )
{
....
}
void hash_enumerate( hash_table *table, void (*func)(char *, void *) )
{
....
}
void printer(char *string, void *data)
{
....
}
void strfree( void *d )
{
....
}
I am making calls from one compilation unit to functions in another by
pointers and I get the warnings below from gcc on 2.4.x Debian Linux. The
executable seems to work fine but the warnings bothers me a lot, mostly
because I don't understand what I did wrong. The code I used I got from the
FAQ on the matter, question 4.12.
"warning: passing arg 2 of `hash_emumerate' from incompatible pointer type"
"warning: passing arg 2 of `hash_free_table' from incompatible pointer
type"
Compilation unit that is calling, stub.o
{
..
int printer(char *, void *data), (*printer_p)( char *, void *) = printer;
int strfree( void *d ), (*strfree_p)( void * ) = strfree;
..
hash_enumerate( &table, printer_p);
..
hash_free_table( &table, strfree_p )
}
================================================
Compilation unit that is being called, hash.o:
void hash_free_table( hash_table *table, void (*func)(void *) )
{
....
}
void hash_enumerate( hash_table *table, void (*func)(char *, void *) )
{
....
}
void printer(char *string, void *data)
{
....
}
void strfree( void *d )
{
....
}