Ethereal-dev: Re: [Ethereal-dev] Plugin API

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

From: Guy Harris <gharris@xxxxxxxxx>
Date: Mon, 29 Oct 2001 19:37:48 -0800
On Mon, Oct 29, 2001 at 05:49:28PM +0100, Tomas Kukosa wrote:
>   Thanks. It works, but only if all plugin composes of only one source
> file. I use more than one file and in this case "p_..." variables are
> declared more then one time and I can not link modules together. I have
> no idea how to use plugin_*.* files without changes. 

There isn't one, in that case.

However, the changes that should be made are changes to the header files
that declare the functions in question; those header files should be
changed to add "extern", e.g.

	#if __GNUC__ >= 2
	extern void       col_add_fstr(frame_data *, gint, gchar *, ...)
	    __attribute__((format (printf, 3, 4)));
	extern void       col_append_fstr(frame_data *, gint, gchar *, ...)
	    __attribute__((format (printf, 3, 4)));
	#else
	extern void       col_add_fstr(frame_data *, gint, gchar *, ...);
	extern void       col_append_fstr(frame_data *, gint, gchar *, ...);
	#endif

rather than

	#if __GNUC__ >= 2
	void       col_add_fstr(frame_data *, gint, gchar *, ...)
	    __attribute__((format (printf, 3, 4)));
	void       col_append_fstr(frame_data *, gint, gchar *, ...)
	    __attribute__((format (printf, 3, 4)));
	#else
	void       col_add_fstr(frame_data *, gint, gchar *, ...);
	void       col_append_fstr(frame_data *, gint, gchar *, ...);
	#endif

A declaration of a function can, I think, leave the "extern" out (my
ANSI C spec is at work, so I can't check it), but the same doesn't apply
to declarations of variables, at least on platforms where the C compiler
and linker use the def/ref model rather than the "common" model used on
many UNIXes.