Ethereal-dev: [ethereal-dev] Win32 plugin DLLs

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

From: Gilbert Ramirez <gram@xxxxxxxxxx>
Date: Tue, 1 Feb 2000 16:28:55 -0600
Yes, I know I said that I wouldn't look at plugins on Win32, but I decided
to look anyway, and I cannot successfully create a DLL on Win32 from packet-gryphon.c.
The problem is that Win32 compilation is foreign to me; I thought perhaps someone on
this list would know.

First, I had to make some changes to packet-gryphon.c. I had to #include <time.h> for
ctime(), and I had to modify the two sections of code that use "long long". Maybe
there's a switch for msvc 6.0's "cl" to use long long's?

But code modifications aside, I have build problems.

In Unix/gcc, I have to compile with "-fPIC", to indicate relocatable object code.
What about on Win32?

I built the object file like this:

cl -nologo <lots of include paths> -DHAVE_CONFIG_H
/FoQ:/forge/build/ethereal/debug/w32-ix86/plugins/gryphon/packet-gryphon.obj
/c Q:/forge/build/ethereal/src/plugins/gryphon/packet-gryphon.c


Then I tried to link via:

link -dll /out:Q:/forge/build/ethereal/debug/w32-ix86/plugins/gryphon/gryphon.dll
Q:/forge/build/ethereal/debug/w32-ix86/plugins/gryphon/packet-gryphon.obj

My error message was:

Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_tree_add_item_hidden
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_tree_add_text
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_item_add_subtree
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_tree_add_item
packet-gryphon.obj : error LNK2001: unresolved external symbol _col_add_str
packet-gryphon.obj : error LNK2001: unresolved external symbol _check_col
packet-gryphon.obj : error LNK2001: unresolved external symbol _pi
packet-gryphon.obj : error LNK2001: unresolved external symbol _dfilter_init
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_register_subtree_array
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_register_field_array
packet-gryphon.obj : error LNK2001: unresolved external symbol _proto_register_protocol
packet-gryphon.obj : error LNK2001: unresolved external symbol _dfilter_cleanup
Q:/forge/build/ethereal/debug/w32-ix86/plugins/gryphon/gryphon.dll : fatal error LNK1120: 12 unresolved externals

Can a DLL reference symbols that are not defined within the DLL? Or do I have to
pass in some struct of function pointers to be able to use the proto_*() and
dfilter_*() routines available in the Ethereal executable?

Am I going about this correctly?

Thanks for any help, even though my question is a bit off topic.

--gilbert