Re: C++ compiler warnings with dlsym() mi.home.com>

From: Mark A. Heilpern (heilpern@mindspring.com)
Date: 02/28/99


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.


At 11:30 AM 2/27/99 -0500, you wrote:
>This isn't really a problem, I'm just trying to eliminate all compiler
>warnings.  The mud is slowly developing into complete c++ for about a year
>now, and I'm trying to eliminate all compiler warnings possible.  Ones that
>I can't seem to get rid of are related to dlsym()... every call to dlsym()
>produces this compiler error:
>
>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"))) {
>
>Does anyone know if a better way I can type-cast that or define "gen" so it
>doesn't product a warning?
>
>Thanks,
>Dan.
>
>
>     +------------------------------------------------------------+
>     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
>     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
>     +------------------------------------------------------------+


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