Re: C++ compiler warnings with dlsym()

From: Daniel Burke (addictmud@home.com)
Date: 02/28/99


On Sun, 28 Feb 1999, Mark A. Heilpern wrote:

> I'm not certain if this will make a difference or not (and, obviously,
> haven't tried it :) but it might help to remove the void parameter declaration?
>
>       void (*gen)();
>
> I compiled (using g++ egcs-2.90.27 980315 (egcs-1.0.2 release) )
> a file that had two variables defined, one as you defined your function
> pointer and one as I suggested. Neither produced any complaint from the
> compiler though.
>
> >comm.c: In function int main(int, char **)':
> >comm.c:249: warning: ANSI C++ forbids cast to non-reference type used as
> >lvalue
> >
> >      void (*gen)(void);
> >
> >      if (!((void*)gen = dlsym(libboot, "boot_world__Fv"))) {

Oky, I think it's my fault for not being clear on exactly which line the
warning is.  The warning happens on the dlsym() line, for any function I try
to load with it, be it an ACMD() type function, or whatever (you should see
the number of warnings I get in this one file that loads several different
functions at bootup)... if I remove the void typecast on that line, I get
this:

comm.c:249: non-lvalue in assignment

Unfortunatly, that is an actual error... I'm using:

eddie:~/addict/src$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.90.29/specs
gcc version egcs-2.90.29 980515 (egcs-1.0.3 release)

for compiler...  the warnings have been there since I started using c++ a
year ago, they're finally getting to me even though it doesn't seem to hurt
the operation of the mud...

Dan.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST