Creating dll and including "winsock.dll" in the Network application

codename47's Avatar, Join Date: Jun 2008
Newbie Member
Hi,I was trying to create a simple dll file.Here is what I did .
First I created dll.h file which looked like this
Code:
#ifndef "dll.h"
#define "dll.h"
/*function prototype*/
void intsum(int);
#endif
then I saved it as dll.h .
Secondly I created a dllmain.cpp
#include<iostream>
#include "dll.h"
using namespace std;
class dll
{
public:
void intsum(int a)
{
a+=a;
cout<<a<<'\n';
}
};
I compiled it and I got a dll called by the of the project which was "Project1.dll"
from here
I include it in the application like this
Code:
#include<iostream>
#include "Project1.dll"
using namespace std;
int main()
{
int number;
printf("Enter Number :");
cin>>number; 
/*Here comes the function defined from the dll*/
function(number);
return 0;
}
But nothing worked,And one the Errors was
"Project1.dll" no such file or directory After this Error I tried to replace the second line with
#include "dll.h" still I got the Error said "function()" is undeclared (first use of this function) From there I didn't have anymore try and Everything stacked just like that.
This code above I was Just a trial Because I was developing a Network Application And I was supposed to include the "winsock.dll" in my application I don't know what to do right now.Any help please on how I going to get away with this. Also any tutorials on how to include the dll's in the application will be helpful.Thanks
0
Cosmic_egg's Avatar, Join Date: Jul 2008
Go4Expert Member
Please understand what is a dll, the approach you take is completely wrong.
Include dll winsock.dll means you should try to get the file from somewhere, usually you will get winsock.dll with the installation of the compiler.
and The above mentioned method is not a way to create a DLL file.