Ethereal-dev: Re: [Ethereal-dev] MSVC build broken(Print.c changes) Patch

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

From: Lars Roland <[email protected]>
Date: Thu, 29 Jul 2004 00:43:32 +0200
Joerg Mayer schrieb:
On Tue, Jul 27, 2004 at 04:37:42PM +0200, Lars Roland wrote:

I will prepare patches, if moving print.c and ps.c out of libethereal is our goal.

It should be.
Here they are. With this patch print.(c/h) and ps.(c/h) don't belong to 
the DISSECTOR_SUPPORT_xy files any longer and as a consequence they 
won't be linked into libethereal. Please check in.
Most other DISSECTOR_SUPPORT_xy files have to be linked into 
libethereal.dll to make it selfcontained. I am not sure about util.c but 
I will find out.
The DISSECTOR_SUPPORT_xy files which have to be linked into libethereal 
should be moved to epan/dissectors or another subdirectory of epan. 
However there are already two DISSECTOR_SUPPORT_xy files in 
epan/dissectors and I'd like to have the other files moved there, too.
Regards,
Lars
Index: ethereal-svn/Makefile.common
===================================================================
--- ethereal-svn/Makefile.common	(revision 11556)
+++ ethereal-svn/Makefile.common	(working copy)
@@ -57,8 +57,6 @@
 	ppptypes.h	\
 	prefs-int.h	\
 	prefs.h	\
-	print.h	\
-	ps.h	\
 	ptvcursor.h	\
 	reassemble.h	\
 	req_resp_hdrs.h	\
@@ -86,6 +84,8 @@
 	conditions.c	\
 	disabled_protos.c	\
 	pcap-util.c	\
+	print.c	\
+	ps.c	\
 	range.c	\
 	ringbuffer.c	\
 	timestats.c	\
@@ -103,6 +103,8 @@
 	file.h	\
 	pcap-util.h	\
 	pcap-util-int.h	\
+	print.h	\
+	ps.h	\
 	range.h	\
 	register.h	\
 	ringbuffer.h	\
Index: ethereal-svn/print.c
===================================================================
--- ethereal-svn/print.c	(revision 11556)
+++ ethereal-svn/print.c	(working copy)
@@ -24,6 +24,10 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
+/* With MSVC and a libethereal.dll this file needs to import some variables 
+   in a special way. Therefore _NEED_VAR_IMPORT_ is defined. */  
+#define _NEED_VAR_IMPORT_
+
 #ifdef HAVE_CONFIG_H
 # include "config.h"
 #endif
Index: ethereal-svn/epan/proto.h
===================================================================
--- ethereal-svn/epan/proto.h	(revision 11556)
+++ ethereal-svn/epan/proto.h	(working copy)
@@ -50,8 +50,8 @@
 #include "tvbuff.h"
 #include "ftypes/ftypes.h"
 
-/** The header-field index for the special text pseudo-field */
-extern int hf_text_only;
+/** The header-field index for the special text pseudo-field. Exported by libethereal.dll */
+ETH_VAR_IMPORT int hf_text_only;
 
 /** the maximum length of a protocol field string representation */
 #define ITEM_LABEL_LENGTH	240
Index: ethereal-svn/epan/dissectors/packet-data.h
===================================================================
--- ethereal-svn/epan/dissectors/packet-data.h	(revision 11556)
+++ ethereal-svn/epan/dissectors/packet-data.h	(working copy)
@@ -24,6 +24,9 @@
 #ifndef __PACKET_DATA_H__
 #define __PACKET_DATA_H__
 
-extern int proto_data;
+/* "proto_data" is exported from libethereal.dll. 
+ * Thus we need a special declaration. 
+ */
+ETH_VAR_IMPORT int proto_data;
 
 #endif /* __PACKET_DATA_H__ */
Index: ethereal-svn/epan/dissectors/packet-frame.h
===================================================================
--- ethereal-svn/epan/dissectors/packet-frame.h	(revision 11556)
+++ ethereal-svn/epan/dissectors/packet-frame.h	(working copy)
@@ -42,8 +42,11 @@
  */
 extern int proto_malformed;
 
-extern int proto_frame;
-extern int hf_frame_arrival_time;
-extern int hf_frame_number;
-extern int hf_frame_packet_len;
-extern int hf_frame_capture_len;
+/* following variables are exported from libethereal.dll. 
+ * Thus we need a special declaration. 
+ */
+ETH_VAR_IMPORT int proto_frame;
+ETH_VAR_IMPORT int hf_frame_arrival_time;
+ETH_VAR_IMPORT int hf_frame_number;
+ETH_VAR_IMPORT int hf_frame_packet_len;
+ETH_VAR_IMPORT int hf_frame_capture_len;
Index: ethereal-svn/epan/libethereal.def
===================================================================
--- ethereal-svn/epan/libethereal.def	(revision 11556)
+++ ethereal-svn/epan/libethereal.def	(working copy)
@@ -86,7 +86,6 @@
 decode_enumerated_bitfield_shifted
 decode_numeric_bitfield
 deletefile
-destroy_print_stream
 dfilter_apply_edt
 dfilter_compile
 dfilter_dump
@@ -282,6 +281,11 @@
 h323_message_body_vals          DATA
 have_tap_listeners
 heur_dissector_add
+hf_frame_arrival_time           DATA
+hf_frame_capture_len            DATA
+hf_frame_number                 DATA
+hf_frame_packet_len             DATA
+hf_text_only                    DATA
 host_name_lookup_process
 incomplete_tcp_stream           DATA
 InfoRequestNakReason_vals       DATA
@@ -298,7 +302,6 @@
 mtp3_addr_to_str_buf
 mtp3_service_indicator_code_short_vals DATA
 new_create_dissector_handle
-new_page
 new_register_dissector
 nt_cmd_vals                     DATA
 num_tap_filters                 DATA
@@ -320,21 +323,14 @@
 prefs_register_string_preference
 prefs_register_uint_preference
 prefs_set_pref
-print_bookmark
-print_finale
-print_hex_data
-print_line
-print_preamble
-print_stream_ps_new
-print_stream_ps_stdio_new
-print_stream_text_new
-print_stream_text_stdio_new
 protocols_module                DATA
 proto_can_match_selected
 proto_can_toggle_protocol
 proto_construct_dfilter_string
+proto_data                      DATA
 proto_find_field_from_offset
 proto_find_finfo
+proto_frame                     DATA
 proto_get_finfo_ptr_array
 proto_get_first_protocol
 proto_get_first_protocol_field
@@ -409,9 +405,6 @@
 proto_tree_add_uint_hidden
 proto_tree_children_foreach
 proto_tree_get_parent
-proto_tree_print
-proto_tree_write_pdml
-proto_tree_write_psml
 p_add_proto_data
 p_get_proto_data
 RasMessage_vals                 DATA
@@ -441,7 +434,6 @@
 rpc_init_prog
 rpc_procs                       DATA
 rpc_proc_name
-rpc_prog_hf
 rpc_progs                       DATA
 rpc_prog_hf
 rpc_prog_name
@@ -505,10 +497,6 @@
 vals_status                     DATA
 val_to_str
 write_prefs
-write_pdml_finale
-write_pdml_preamble
-write_psml_finale
-write_psml_preamble
 xml_escape
 
 
Index: ethereal-svn/epan/Makefile.common
===================================================================
--- ethereal-svn/epan/Makefile.common	(revision 11556)
+++ ethereal-svn/epan/Makefile.common	(working copy)
@@ -42,8 +42,6 @@
 	../in_cksum.c	\
 	../ipproto.c	\
 	../prefs.c	\
-	../print.c	\
-	../ps.c	\
 	../ptvcursor.c	\
 	../reassemble.c	\
 	../req_resp_hdrs.c	\