[tcpdump-workers] Adding loopback adapter detection for Windows

Gisle Vanem gvanem at yahoo.no
Mon Jan 25 10:56:33 EST 2016


Yang Luo wrote:

> 1) Modified the CMakeLists.txt Line 3 from
> set( PROJECT_NAME pcap )
> to
> set( PROJECT_NAME wpcap )
> I thought the output binary should be wpcap.dll instead of pcap.dll, so I
> just changed it, I don't know if this is the correct move..

No, it seems be require "set( PROJECT_NAME PCAP )"  (upper-case). Why?
Look in pcap/export-defs.h:

#if defined(_WIN32)
  #ifdef BUILDING_PCAP
    /*
     * We're compiling libpcap, so we should export functions in our
     * API.
     */
    #define PCAP_API_DEF    __declspec(dllexport)
  #else
    #define PCAP_API_DEF    __declspec(dllimport)
  #endif

-----

Otherwise the generated *.make files says '-DBUILDING_pcap'.
Thus your wpcap.dll exports nothing. But this produces PCAP.dll.
But I'm not familiar with Cmake.

> 3) Open the generated J:\npcap\wpcap\PRJ\wpcap.sln with MSVC 2005. Then
> build the solution with configuration "Release" "Win32". (I don't know how
> to generate both "Win32" and "x64" using CMake, it's inconvenient to only
> have one platform in one sln).

Not sure, but my cmake supports:
  cmake -G "Visual Studio 14 2015 Win64" ..

(Win32 is implicit).

-- 
--gv



More information about the tcpdump-workers mailing list