On Thu, May 16, 2002 at 06:03:22PM -0700, Albert Kinderman wrote:
> Disclaimer: I am not a programmer!
>
> I am trying to compile scribus-0.7.2, a Page Layout program, built
> against qt3. /usr/ports/print/scribus contains scribus-0.5, which
> is the qt2 version.
>
> On my Debian GNU/Linux, make works without a hitch. On my FreeBSD
> stable box, I get a series of errors of the following type:
>
> scribus.cpp:4217: assignment to `char *' from `const char *'
> discards qualifiers
> scribus.cpp: In method `int ScribusApp::DLLType(QString)':
> scribus.cpp:4240: assignment to `char *' from `const char *'
> discards qualifiers
> *** Error code 1
>
> Stop in /usr/local/scribus-0.7.2/scribus
>
> These errors come from code similar to code that is given as an
> example of how to handle exceptions in the Linux man page for
> dlerror, /usr/compat/linux/man/man3/dlopen.3 Specifically, the
> last error was produced by
>
> int ScribusApp::DLLType(QString name)
> {
> void *mo;
> char *error;
> typedef int (*sdem0)();
> sdem0 demo;
> QString pfad = PREL;
> pfad += "/share/scribus/plugins/" + name;
> mo = dlopen(pfad, RTLD_LAZY);
> if (!mo)
> return 0;
> dlerror();
> demo = (sdem0)dlsym(mo, "Type");
> if ((error = dlerror()) != NULL) <-- line 4240
> {
> dlclose(mo);
> return 0;
> }
> int an = (*demo)();
> dlclose(mo);
> return an;
> }
>
>
> Both the FreeBSD and the Linux man pages list
>
> const char *dlerror(void)
>
> Why does c++ on FreeBSD produce an error on
> error = dlerror()
> and c++ on Debian Linux does not? What is the proper fix?
Either you don't compile with warnings enabled on Linux or Linux doesn't
declare dlerror returning a const char*.
Nevertheless the manpage function declaration says that you should
have defined your error variable as a const char* too.
In fact the error variable is written only, which obsoletes it anyway.
You could just do:
if (dlerror() != NULL)
--
B.Walter COSMO-Project http://www.cosmo-project.de
[EMAIL PROTECTED] Usergroup [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message