INF: Extended Procedure Error: "Cannot find the DLL 'xxx.dll'"

Last reviewed: May 2, 1997
Article ID: Q151596

The information in this article applies to:
  • Microsoft SQL Server, version 6.0

SUMMARY

SQL Server generically returns the error: "Cannot find the DLL 'xxx.dll'" when there is a problem loading the extended stored procedure.

MORE INFORMATION

There are several problems that could actually be encountered. Among these are: DLL not in the correct path, subsidiary DLLs like MFC40.DLL is not in the path, function not found, or any other error that would cause the loading of the extended stored procedure DLL to fail.

There are a couple techniques that you can use to identify the errors. First, you need to re-visit the path and make sure the DLL is in the path. You should also double check the sp_helptext for the procedure to make sure the name is correct.

If these efforts still do not identify the problem, you may be able to use the following code snippet to identify the error. The code loads the specified library and tries to access the function. If it fails to load, it will print the associated OS error message.

#include "windows.h"
#include "stdio.h"

//
//    Functions
//
typedef int (*fnInternal)(void);
void main(int iArgs, char *strArgs[], char *strEnvs[]);
void vUsage(void);


//
//    Main function
//
void main(int iArgs, char *strArgs[], char *strEnvs[])
{
   HINSTANCE   hLib        =  NULL;
   fnInternal  fCall       =  NULL;
   char     strMsg[1025]   =  "";

   if(iArgs == 3)
   {

      printf("\nAttempting to load %s - %s\n",
               strArgs[1], strArgs[2]);

      if( (hLib = LoadLibrary(strArgs[1])) != NULL)
      {
         fCall = (fnInternal)GetProcAddress(hLib, strArgs[2]);
         if(fCall)
         {
            printf("%s found and loaded successfully.\n",
strArgs[2]);
         }
         else
            printf("%s not found in %s.\n", strArgs[2],
strArgs[1]);

         FreeLibrary(hLib);
      }
      else
      {
         ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
                     NULL,
                     GetLastError(),
                     GetSystemDefaultLangID(),
                     strMsg,
                     sizeof(strMsg) -1,
                     NULL);

         printf("Error %ld %s\n", GetLastError(), strMsg);
      }

   }
   else
      vUsage();

   printf("\n");
}

//
//    vUsage
//
void vUsage(void)
{

   printf("\n"
         "Usage: Loadlib.exe libname function\n"
         "\n"
         "Where: libname  = 8.3 name of library\n"
         "       function = name of function in the library\n"
         "\n"
         "Example: loadlib xpstar.dll xp_servicecontrol\n");

}


Additional query words: tshoot
Keywords : kbprg SSrvStProc
Version : 6.0
Platform : WINDOWS
Resolution Type : kbcode


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: May 2, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.