Ethereal-dev: RE: [Ethereal-dev] C++ plugins

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

From: Andreas Sikkema <h323@xxxxxxxxxx>
Date: Tue, 28 Feb 2006 16:01:20 +0100
On Tue, 2006-02-28 at 06:34 -0800, Jasim Tariq wrote:
> >Check out packet-h225.c on how to use C++ classes from an
> >Ethereal plugin.
> 
> You mean packet-h225.cxx right? I tried this option, but while building I 
> get an error "Cannot open include file: 'glib.h': No such file or directory. 
> even if I comment out the code that calls C++ classes, I still get the same 
> error. However, the error dissappears once I rename the plugin to .c in 
> stead of .cxx or .cpp. There must be a way so that I can make small changes 
> to the functions in C++ classes which I am using in my C source code and a 
> calling technique inside my C source code to accesss these functinos. Any 
> examples?

Do you have a working Ethereal development environment? Do you have a
working plugin (using C sources)? 

Then create a new source file that will become the entry point to the C
++ plugin. Let it be compiled and linked as if it were a C++
application. Then wrap all code inside the plugin with a extern "C"{}
block. That's basically the trick. It is NOT easy, it took me a couple
of days before I could make it work. You need to fiddle with Makefiles a
lot! I'm sorry I can't help you more, but it's been 6 years since I made
it work....

-- 
Andreas Sikkema