Thanks man. It's working now.

One more thing: I want to link it to libpcap or any other dynamic library to add more functionality. What do I do?