0

I downloaded WinPcap and extracted all the files to my C:\ drive, and did all the things described here.

Then, I added the CGO directives to my main.go and built the program with "go build".

I'm doing all this on windows. but windows totally ignores these directives.

If I start the program, it crashes because wpcap.dll is missing.

Here are my directives:

// #cgo solaris LDFLAGS: -L /opt/local/lib -lpcap
// #cgo linux LDFLAGS: -lpcap
// #cgo dragonfly LDFLAGS: -lpcap
// #cgo freebsd LDFLAGS: -lpcap
// #cgo openbsd LDFLAGS: -lpcap
// #cgo darwin LDFLAGS: -lpcap
// #cgo windows CFLAGS: -I C:/WpdPack/Include
// #cgo windows,386 LDFLAGS: -L C:/WpdPack/Lib -lwpcap
// #cgo windows,amd64 LDFLAGS: -L C:/WpdPack/Lib/x64 -lwpcap
// #include <stdlib.h>
// #include <pcap.h>

What am I doing wrong?

Leon
  • 2,926
  • 1
  • 25
  • 34
Eric
  • 115
  • 1
  • 10
  • sry i forgot to mention that i want to use gopacket in my program. but i cant start it if no wpcap.dll is unter system32-Folder. it just crashes – Eric Aug 24 '18 at 11:31
  • even if i build all this in linux (cross compiling) the program crashes if the dll is missing? is it possible to solve that? – Eric Aug 24 '18 at 13:58
  • it seems to be impossible. elastic beats (packet analyzer) also need winpcap preinstalled! – Eric Aug 30 '18 at 21:29

0 Answers0