Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
Greenis
Member.
720 views

lr_load_dll works in VuGen, but don't in Controller

Jump to solution

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 (3)
0 Likes
1 Solution

Accepted Solutions
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: lr_load_dll works in VuGen, but don't in Controller

Jump to solution

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.

 

Signature:
Reward community members who take time to respond and help.

View solution in original post

3 Replies
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: lr_load_dll works in VuGen, but don't in Controller

Jump to solution

You need to add the DLLs as 'Extra Files' in VuGen. Then they are copied to the load generator when running from the controller.

Signature:
Reward community members who take time to respond and help.
0 Likes
Greenis
Member.

Re: lr_load_dll works in VuGen, but don't in Controller

Jump to solution

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.

0 Likes
Outstanding Contributor.. JHF Remmelzwaal Outstanding Contributor..
Outstanding Contributor..

Re: lr_load_dll works in VuGen, but don't in Controller

Jump to solution

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.

 

Signature:
Reward community members who take time to respond and help.

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.