Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Error "the procedure entry point Getaddrinfo could not be located in the dynamic link library WS2_32.dll"

Error "the procedure entry point Getaddrinfo could not be located in the dynamic link library WS2_32.dll"

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rahul Vaishnav
    wrote on last edited by
    #1

    Hi all, I am calling some methods from the Web service which i have added to my solution. For Example please refer below code. below code is perfectly running fine on XP,Vista but i have tested it on Windows 2000 prof.

    line 1: CoInitialize(NULL);
    line 2: xyzService::CxyzService test;
    line 3: CComBSTR result;
    line 4: test.Methodname(CComBSTR(L"0001"),CComBSTR (L"0001"),&result);
    line 5: CoUninitialize();

    if i run this code in Win 2000 it gives below error, "the procedure entry point Getaddrinfo could not be located in the dynamic link library WS2_32.dll" if i comment line no. 4 from above code,it runs properly. This error is arriving due to call of any method in webservice. Please help me to find some solution. Thanks in advance

    L 1 Reply Last reply
    0
    • R Rahul Vaishnav

      Hi all, I am calling some methods from the Web service which i have added to my solution. For Example please refer below code. below code is perfectly running fine on XP,Vista but i have tested it on Windows 2000 prof.

      line 1: CoInitialize(NULL);
      line 2: xyzService::CxyzService test;
      line 3: CComBSTR result;
      line 4: test.Methodname(CComBSTR(L"0001"),CComBSTR (L"0001"),&result);
      line 5: CoUninitialize();

      if i run this code in Win 2000 it gives below error, "the procedure entry point Getaddrinfo could not be located in the dynamic link library WS2_32.dll" if i comment line no. 4 from above code,it runs properly. This error is arriving due to call of any method in webservice. Please help me to find some solution. Thanks in advance

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi Rahul, Your webservice may be calling the Unicode version of GetAddrInfo. And if you have a look at the MSDN for the GetAddrInfoW Function[^] it states that the minimum operating system is Windows XP with SP2. Windows 2000 should support the ANSI version: getaddrinfo function[^] Best Wishes, -David Delaune

      R 1 Reply Last reply
      0
      • L Lost User

        Hi Rahul, Your webservice may be calling the Unicode version of GetAddrInfo. And if you have a look at the MSDN for the GetAddrInfoW Function[^] it states that the minimum operating system is Windows XP with SP2. Windows 2000 should support the ANSI version: getaddrinfo function[^] Best Wishes, -David Delaune

        R Offline
        R Offline
        Rahul Vaishnav
        wrote on last edited by
        #3

        hi Randor, thanks for your reply. Actually I am using a service which is made in DotNet(C#) by DotNet Team :). Is it possible to overcome this problem through our client Application(My MFC application)? Regards, Rahul Vaishnav

        L 1 Reply Last reply
        0
        • R Rahul Vaishnav

          hi Randor, thanks for your reply. Actually I am using a service which is made in DotNet(C#) by DotNet Team :). Is it possible to overcome this problem through our client Application(My MFC application)? Regards, Rahul Vaishnav

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Hi Rahul, You can use the ANSI version by explicitly calling the GetAddrInfoA function. Make sure that you pass ANSI strings to the function. Best Wishes, -David Delaune

          R 1 Reply Last reply
          0
          • L Lost User

            Hi Rahul, You can use the ANSI version by explicitly calling the GetAddrInfoA function. Make sure that you pass ANSI strings to the function. Best Wishes, -David Delaune

            R Offline
            R Offline
            Rahul Vaishnav
            wrote on last edited by
            #5

            Hi Randor, thanks for reply.. I have done code like below but still i have same problem. :( Please let me know am i coding in the right direction, because this thing is new for me..

            WSADATA wsaData;
            int iResult;
            DWORD dwRetval;
            int i = 1;
            char *port = "80"; // I am using http protocol
            struct addrinfo *result = NULL;
            struct addrinfo *ptr = NULL;
            struct addrinfo hints;
            // Initialize Winsock
            iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
            if (iResult != 0) {
            printf("WSAStartup failed: %d\n", iResult);
            return 1;
            }

            //--------------------------------
            // Setup the hints address info structure
            // which is passed to the getaddrinfo() function
            ZeroMemory( &hints, sizeof(hints) );
            hints.ai\_family = AF\_UNSPEC;
            hints.ai\_socktype = SOCK\_STREAM;
            hints.ai\_protocol = IPPROTO\_TCP;
            

            //--------------------------------"
            // Call getaddrinfo(). If the call succeeds,
            // the result variable will hold a linked list
            // of addrinfo structures containing response
            // information

            dwRetval = getaddrinfo("xx.x.xxx.xxx", "80", &hints, &result);
            if ( dwRetval != 0 ) {
                printf("getaddrinfo failed with error: %d\\n", dwRetval);
                WSACleanup();
                return 1;
            }
            

            line 1: CoInitialize(NULL);
            line 2: xyzService::CxyzService test;
            line 3: CComBSTR result1;
            line 4: test.Methodname(CComBSTR(L"0001"),CComBSTR (L"0001"),&result1);
            line 5: CoUninitialize();

            freeaddrinfo(result);
            WSACleanup();

            L 2 Replies Last reply
            0
            • R Rahul Vaishnav

              Hi Randor, thanks for reply.. I have done code like below but still i have same problem. :( Please let me know am i coding in the right direction, because this thing is new for me..

              WSADATA wsaData;
              int iResult;
              DWORD dwRetval;
              int i = 1;
              char *port = "80"; // I am using http protocol
              struct addrinfo *result = NULL;
              struct addrinfo *ptr = NULL;
              struct addrinfo hints;
              // Initialize Winsock
              iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
              if (iResult != 0) {
              printf("WSAStartup failed: %d\n", iResult);
              return 1;
              }

              //--------------------------------
              // Setup the hints address info structure
              // which is passed to the getaddrinfo() function
              ZeroMemory( &hints, sizeof(hints) );
              hints.ai\_family = AF\_UNSPEC;
              hints.ai\_socktype = SOCK\_STREAM;
              hints.ai\_protocol = IPPROTO\_TCP;
              

              //--------------------------------"
              // Call getaddrinfo(). If the call succeeds,
              // the result variable will hold a linked list
              // of addrinfo structures containing response
              // information

              dwRetval = getaddrinfo("xx.x.xxx.xxx", "80", &hints, &result);
              if ( dwRetval != 0 ) {
                  printf("getaddrinfo failed with error: %d\\n", dwRetval);
                  WSACleanup();
                  return 1;
              }
              

              line 1: CoInitialize(NULL);
              line 2: xyzService::CxyzService test;
              line 3: CComBSTR result1;
              line 4: test.Methodname(CComBSTR(L"0001"),CComBSTR (L"0001"),&result1);
              line 5: CoUninitialize();

              freeaddrinfo(result);
              WSACleanup();

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Hi Rahul, What happens if you change this line:dwRetval = getaddrinfo("xx.x.xxx.xxx", "80", &hints, &result);
              intodwRetval = **GetAddrInfoA**("xx.x.xxx.xxx", "80", &hints, &result);
              [Update] Also... the CComBSTR is going to be a Unicode string so this is all wrong. Best Wishes, -David Delaune

              1 Reply Last reply
              0
              • R Rahul Vaishnav

                Hi Randor, thanks for reply.. I have done code like below but still i have same problem. :( Please let me know am i coding in the right direction, because this thing is new for me..

                WSADATA wsaData;
                int iResult;
                DWORD dwRetval;
                int i = 1;
                char *port = "80"; // I am using http protocol
                struct addrinfo *result = NULL;
                struct addrinfo *ptr = NULL;
                struct addrinfo hints;
                // Initialize Winsock
                iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
                if (iResult != 0) {
                printf("WSAStartup failed: %d\n", iResult);
                return 1;
                }

                //--------------------------------
                // Setup the hints address info structure
                // which is passed to the getaddrinfo() function
                ZeroMemory( &hints, sizeof(hints) );
                hints.ai\_family = AF\_UNSPEC;
                hints.ai\_socktype = SOCK\_STREAM;
                hints.ai\_protocol = IPPROTO\_TCP;
                

                //--------------------------------"
                // Call getaddrinfo(). If the call succeeds,
                // the result variable will hold a linked list
                // of addrinfo structures containing response
                // information

                dwRetval = getaddrinfo("xx.x.xxx.xxx", "80", &hints, &result);
                if ( dwRetval != 0 ) {
                    printf("getaddrinfo failed with error: %d\\n", dwRetval);
                    WSACleanup();
                    return 1;
                }
                

                line 1: CoInitialize(NULL);
                line 2: xyzService::CxyzService test;
                line 3: CComBSTR result1;
                line 4: test.Methodname(CComBSTR(L"0001"),CComBSTR (L"0001"),&result1);
                line 5: CoUninitialize();

                freeaddrinfo(result);
                WSACleanup();

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Hi Rahul, Change your definitions to the following and the MSVC compiler should link with the correct version of the function: You can keep your call to getaddrinfo.#define WINVER 0x0500 #define _WIN32_WINNT 0x0500
                I just tested this on my Win2k box and your call to getaddrinfo was successful. Best Wishes, -David Delaune

                R 1 Reply Last reply
                0
                • L Lost User

                  Hi Rahul, Change your definitions to the following and the MSVC compiler should link with the correct version of the function: You can keep your call to getaddrinfo.#define WINVER 0x0500 #define _WIN32_WINNT 0x0500
                  I just tested this on my Win2k box and your call to getaddrinfo was successful. Best Wishes, -David Delaune

                  R Offline
                  R Offline
                  Rahul Vaishnav
                  wrote on last edited by
                  #8

                  Thankyou friend it is working properly...

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups