Very well explaind Saswat and also for creating the DLL you can refer to Creating a simple DLL