Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] assert() in DOCSIS plugin causes __eprintf undefined symbol

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sun, 6 Jul 2003 14:40:27 -0700
On Fri, Jul 04, 2003 at 11:33:00AM -0700, Michael Lum wrote:
> I am building 0.9.13 on Sparc/Solaris 2.8.
> Using gcc.
> 
> The file packet-vendor.c has an assert() that
> causes a runtime load problem.  The symbol __eprintf
> is not found.  I understand that the missing symbol
> problem occurs when some objects are built with cc and
> some with gcc.

Yes, and that's probably what you're seeing - on my Solaris 7 partition,
at least Sun's <assert.h> makes the "assert()" macro call "_assert()",
whilst the GCC header file refers to "__eprintf" or something such as
that, noting that it appears in libgcc.a.

It may be that the plugin is somehow not being linked against libgcc.a,
or this might be some issue of a shared vs. static libgcc.

> What's the difference between g_assert() and assert()?

"assert()" is the ANSI C assertion macro, which, for whatever reason,
differs between the header supplied with Solaris and the header that GCC
uses; they call different routines.

"g_assert()" is the GLib version; it calls "g_log()".

Why those differences exist, and in what way those differences are
interesting, is another matter; I have not bothered to look into that.

In any case, the problem could probably be solved either by

	1) using "g_assert()", as we do elsewhere in Ethereal, rather
	   than "assert()"

or

	2) just getting rid of the "assert()" and relying on null
	   pointer dereferences causing crashes (which they do on most,
	   if not all, of the platforms on which Ethereal runs).