INF: Extended Procedure Error: "Cannot find the DLL 'xxx.dll'"Last reviewed: May 2, 1997Article ID: Q151596 |
The information in this article applies to:
SUMMARYSQL Server generically returns the error: "Cannot find the DLL 'xxx.dll'" when there is a problem loading the extended stored procedure.
MORE INFORMATIONThere 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |