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

Wireshark-dev: Re: [Wireshark-dev] Why isn't libwireshark.def autogenerated?

From: Andreas <AndreasSander1@xxxxxxx>
Date: Sun, 19 Dec 2010 13:49:04 +0100
Am 18.12.2010 19:28, schrieb Gregory Seidman:
On Sat, Dec 18, 2010 at 10:57:29AM +0100, Andreas wrote:
[...]

// proto.h

WIRESHARKAPI proto_tree* proto_tree_create_root(void);

WIRESHARKAPI proto_item *
proto_tree_add_item(proto_tree *tree, const int hfindex, tvbuff_t *tvb,
      const gint start, gint length, const guint encoding);

Looks good to me. Maybe WSPUBLIC or WSEXPORT would be a clearer name, but
that's a detail to be worked out.

Well, the WINAPI definition is used in the Windows API (defined by Microsoft). FSDAPI declares functions exported by the FSD (file system driver) API.

The EXPORT is used in a different way: When you compile the FOO DLL, usually the FOO_EXPORTS is set. This is used to control if you get __declspec(import) or __declspec(exports).

Therefore I would suggest not to use WSEXPORT to defined a symbol that is part of the API.


The has some advantages

- one central place to define how the functions become part of the API
in config.h

- exactly one place of definition if a symbol is part of the API.
Currently you define the symbol in header and DEF file.

- It is visible immediately if a declaration in the header files is part
if the API or not.

Vital. I keep finding things in header files I want to use, then have to
check the .def file to discover whether it's exported.

When we have an API definition in the header file, this will allow us to add the doxygen documentation of that API at the same point.

--
Andy