libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a small C warning


From: Tim Mooney
Subject: Re: a small C warning
Date: Tue, 10 Jul 2001 14:08:45 -0500 (CDT)

In regard to: a small C warning, Sebastien Sable said (at 8:36pm on Jul 10,...:

>sorry if this is not really specific to libtool but it I have this
>little boring warning in a file of mine when using lt_dladdsearchdir :
>
>gcc -DHAVE_CONFIG_H -I. -I. -I.. -DSYSCONFDIR=\"/usr/local/etc\" 
>-DPKGDATADIR=\"/usr/local/share/libbraille\" 
>-DPKGLIBDIR=\"/usr/local/lib/libbraille\" -g -O2 -Wall -I../include -c 
>braille.c          -fPIC -DPIC -o .libs/braille.lo
>braille.c: In function `load_braille_driver':
>braille.c:489: warning: assignment makes pointer from integer without a cast
>
>which correspond to this line :
>
>error = lt_dladdsearchdir(PKGLIBDIR);
>
>I tried different kinds of cast without success.

That's not the right approach -- casting it would hide a real error.

>The program works great anyway so it must be nothing, but if someone
>has an idea...

It's not nothing, at least on architectures that aren't ILP32.  Your program
will work fine on Linux on Intel, but it will fail on 64 bit (LP64) OSes.

The problem is that there is no prototype for ld_dladdsearchdir, so
the compiler is assuming it returns an int.  error is apparently some
type of pointer, right?  The assignment your doing is taking the *assumed*
int return value from the function call and converting it into the required
pointer type.

What you need to do is make sure there's a prototype for that function
available, so that the compiler knows that the function returns a pointer,
not an int.

Tim
-- 
Tim Mooney                              address@hidden
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164




reply via email to

[Prev in Thread] Current Thread [Next in Thread]