lr_load_dll works in VuGen, but don't in Controller

In my C-web scripts I need to connect with PostgreSQL. For it I uses libpq from db distrib. In root of the script I place this dll's: kernel32.dll, libiconv-2.dll, libintl-8.dll, libeay32.dll, ssleay32.dll, libpq.dll

and in vuser_init.c loads this dlls in same order via lr_load_dll.

This run perfectly from VuGen, but in Controller this script fails with messages that it can't find libeay32.dll, ssleay32.dll and libpq.dll

"Error: C interpeter run time error: include/db/manager,h(29) Error -- File error : LoadLibrary(*) failed : ."

I tryed replace libeay32.dll and ssleay32.dll on libeay32_lt.dll and ssleay32_lt.dll which found in bin folder of LR, but remains same error for libpq.dll.

Tags:

Parents Reply Children
  • Controller run this script locally on same machine and it finds others files except libpq.dll.

    Also I prepare new script where put dll's to "Extra files". In controller this script is crashed immediately to status "Error" without any information what is wrong. I browsed all files in script directory and in result directory, but found none clues.

  • Verified Answer

    You use the same DLLs as LR does, but might need other versions. You cannot load a DLL with the same name and different versions twice. You have to make sure that LR is not loading those DLLs on your LG. (You can use Process Monitor or Process Explorer of sysinternals.com for that).

    A DLL without a path is not always loaded from script dir. When you want to load it from script dir use full qualified path. You might like the following code:

    #define CWD_LEN  1023
    char    cwd[CWD_LEN 1];
    int     cwdlen  =  0;
    int  my_load_dll(char  *dll)
    {
      if(  !  cwdlen  )  {
        getcwd(cwd,  CWD_LEN);
        if(  (cwdlen  =  strlen(cwd))  ==  0  )  {
          lr_error_message("my_load_dll:  Fatal:  cwd  too  long");
          return  10;
        }
      }
      if(  cwdlen     strlen(dll)     1  >  CWD_LEN  )  {
        lr_error_message("my_load_dll:  Fatal:  full  path  too  long");
        return  10;
      }
      cwd[cwdlen]='\\';  cwd[cwdlen 1]  =  '\0';
      strcat(cwd,  dll);
      return  lr_load_dll(cwd);
    }

    Just replace lr_load_dll with my_load_dll and you will load each DLL from your script directory.

    When LG loads its own versions of the DLLs as well, you need to experiment with those DLLs. Maybe you can find a version of libpq.dll that matches with the ones used by LR.