Wireshark-dev: Re: [Wireshark-dev] mix of c and C++
From: sagar Guledagudda <[email protected]>
Date: Tue, 19 Jul 2011 14:58:10 +0530
Thank you, i have solved the problem by compling with   -DHAVE_CONFIG_H flag .
On Tue, Jul 19, 2011 at 11:53 AM, Helge Kruse <[email protected]> wrote:
Am 19.07.2011 07:10, schrieb sagar Guledagudda:

I am compiling it for linux ( xxx.so file )

Includes files are as below

# include "config.h"
//      fastfix API

CC   = g++


        mkdir -p $(PLUGIN_DIR)
        $(CC) -shared $(OBJS) $(LIBS)-o [email protected]
%.o : %.cpp
        $(CC) $(CFLAGS) $(LIBS) $<  -o [email protected]

A Unix shared library exports all non-private symbols while a Windows dynamic link library exports only the symbols that are defined in the export list. To access variables in the Wireshark.so you need to declare the symbol 'extern'. You need to declare the symbol as '__declspec(dllimport) extern' to access it in the Wireshark.dll.
The config.h defines a macro WS_VAR_IMPORT with the appropriate definition.

If you don't include the config.h WS_VAR_IMPORT is not replaced with anything and your compiler gets confused. If your curious you can check this by *temporarily* change the actual compiler flags and replace -c by -E to get a preprocessed source file. Look for WS_VAR_IMPORT or _NEED_VAR_IMPORT_ in that file.

To solve your problem you should define HAVE_CONFIG_H, probably with


But the makefiles are usually autogenerated.

@all: What is the sense behind the HAVE_CONFIG_H if I need it anyway?

Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
           mailto:[email protected]wireshark.org?subject=unsubscribe