From nobody  Thu Jul  9 15:31:46 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id PAA06998;
          Thu, 9 Jul 1998 15:31:46 -0700 (PDT)
          (envelope-from nobody)
Message-Id: <199807092231.PAA06998@hub.freebsd.org>
Date: Thu, 9 Jul 1998 15:31:46 -0700 (PDT)
From: cts@internetcds.com
To: freebsd-gnats-submit@freebsd.org
Subject: /usr/include/pcap*.h isn't C++ safe.
X-Send-Pr-Version: www-1.0

>Number:         7229
>Category:       misc
>Synopsis:       /usr/include/pcap*.h isn't C++ safe.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul  9 15:40:01 PDT 1998
>Closed-Date:    Thu Aug 6 23:21:16 PDT 1998
>Last-Modified:  Thu Aug  6 23:21:31 PDT 1998
>Originator:     Craig Spannring
>Release:        2.2.6 and 3.0
>Organization:
InternetCDS
>Environment:
FreeBSD backmaster.cdsnet.net 3.0-CURRENT FreeBSD 3.0-CURRENT #2: Tue May  5 20:30:34 PDT 1998     root@backmaster.cdsnet.net:/n/FreeBSD/3.0-back2/src/sys/compile/BACK2  i386

>Description:
None of the header files for the packet capture library 
are suitable to include in a C++ file.  They are missing the

  #ifdef __cplusplus
  extern "C" {
  #endif

to give the declared functions C linkage

>How-To-Repeat:
Trying to compile this-
#include <iostream.h>

#include <pcap.h>

main(int argc, char **argv)
{
   pcap_t    *cap = NULL;
   char       errorBuf[4096];

   cap = pcap_open_offline(argv[1], errorBuf);
   if (cap == NULL)
   {
      cout << "Error-  " << errorBuf << endl;
      exit(1);
   }
}


as a C++ program will give this error-

c++ tcpdump.cxx
/var/tmp/ccR273601.o: Undefined symbol `_pcap_open_offline__FPcT0' referenced from text segment


>Fix:
Add the 

  #ifdef __cplusplus
  extern "C" {
  #endif

incantation to the begining of each of the pcap*.h files.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: phk 
State-Changed-When: Sat Jul 11 01:16:53 PDT 1998 
State-Changed-Why:  
could you please submit a tested patch ? 
State-Changed-From-To: feedback->closed 
State-Changed-By: phk 
State-Changed-When: Thu Aug 6 23:21:16 PDT 1998 
State-Changed-Why:  
committed, thanks! 
>Unformatted:
