1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

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

Discussion in 'MFC' started by codename47, Jul 28, 2008.

  1. codename47

    codename47 New Member

    Joined:
    Jun 30, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. Cosmic_egg

    Cosmic_egg New Member

    Joined:
    Jul 21, 2008
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page