Forum Discussion

mfoster711's avatar
mfoster711
Regular Contributor
11 years ago

Strange DLL issue

Is there a way to force TestComplete to release a DLL I have loaded and clear it from memory?

 

I have a DLL I use in my testing. This DLL was created by our programming department to get information from some of our custom fields(e.g. lists, grids) in our PC applications. There are two different PC applications we test. They are created with the same base code but are completely different applications and I use the DLL in testing both applications.  

 

The DLL I use is installed in a directory under each application. For example:

  • c:\App1\System\Bin\MyDLL.dll
  • c:\App2\System\Bin\MyDLL.dll

Depending on which application I am testing I load the corresponding DLL.

 

This DLL works fine when I am testing just one of the applications but I have a need to now test features in both applications in the same test run and this is causing MyDLL to have issues. Some of the functions are returning bad information when I use them in this manner. It appears that TestComplete is holding onto the reference for the DLL in the first test and it is messing up the call on the second test.

 

3 Replies

  • mfoster711's avatar
    mfoster711
    Regular Contributor

    I spoke with my programming department about our DLL and got more information. 

     

    This DLL reads a config file when it gets "Loaded" and the config file is specific to the application being tested. They said to "unload" the DLL file when switching between applications to ensure the correct config file gets reads. 

     

    So, how do I "unload" a DLL file? There does not appear to be an option for this.

  • mfoster711's avatar
    mfoster711
    Regular Contributor

    A little more information. 

     

    What really confuses is that I use completely different variables names and lybrary type for the DLL when I load it and define the functions. There are no duplicated references between the two DLLs. The DLLs live in different folders and I define them and load them completely independent of the other. But, I guess since the DLLs are techincally the same file that when it gets loaded to memory it knows this and treats them the same??

    • joseph_michaud's avatar
      joseph_michaud
      Icon for Staff rankStaff

      Are you using the DLL object in TestComplete to load the DLL?  If so, perhaps the ClearSettingsBeforeEachRun property in the IDLLAccessProcessOptions Object Properties may help.

       

      You could also try experimenting with the process Refresh() and RefreshMappingInfo() methods in the faint hope that they can in some way cause the DLL change to be noticed.

       

       

      Or you may want try renaming one of your DLLs.  Hopefully TestComplete will consider them as two separate DLLs.  Searching on "windows rename DLL" brought me to various pages describing the use of DUMPBIN, and finally

       

      https://support.microsoft.com/en-us/kb/131313  "How to Create 32-bit Import Libraries Without .OBJS or Source"