Wireshark-dev: Re: [Wireshark-dev] Building plugins for both win32 & win64
From: Andreas <[email protected]>
Date: Thu, 26 Jan 2012 20:35:29 +0100
Am 19.01.2012 18:20, schrieb Teto:
I am very eager to know the answer since I am currently fighting to build both.
I don't know how I did it but in fact, I 've got 2 folders:
-wireshark-win32-lib
-wireshark-win64-lib

I think I have built correctly all libs in the 2 directories, but
whenever I try compiling wireshark in 32 bits (set
WIRESHARK_TARGET_PLATFORM=win32 within a x86 visual command prompt),
I've got this error:

"inffas32.obj : fatal error LNK1112: module machine type 'X86'
conflicts with target machine type 'x64'"

I've got no pb compiling into 64bits. (I call vcvars64bits,set
WIRESHARK_TARGET_PLATFORM=win64).

any help/doc on this could be useful.
Well I usually don't need to build Wireshark, when I want to compile a 
dissector plugin. All I need
- to compile my C++ files are the header files
- to link my plugin DLL is the appropriate libwireshark.lib
- to debug my plugin are the source files and the .pdb files.

The Wireshark developers provide the .pdb files what is of great value. To build the import library I use this small script:
setlocal
mkdir x86
mkdir x64
pushd wireshark-1.6.0\epan
call :build amd64     x64
call :build x86_amd64 x86
popd
endlocal
goto :eof

:build
setlocal
call "%VS90COMNTOOLS%\..\..\VC\vcvarsall.bat" %1
link /force /def:libwireshark.def /out:libwireshark.dll /implib:..\..\%2\libwireshark.lib
del libwireshark.dll
endlocal
goto :eof

That's all. It takes about a second to run. No Cygwin installed, neither Python nor Perl. Neither msbuild not powershell.
I know that the generated libwireshark.dll is unusable. But Wireshark 
comes with a working version.
When we can convince the Wireshark developers to archive and provide the 
import libraries for a even branch e.g. 1.6.x or odd version 1.7.3 we 
can build plugins with much less effort.
--
Andy