Error loading dll

Hi

 

I'm integrating ProjectWise with Lotus Notes - so far so good.  My code is running well on my machine, however when testing my code on a user's machine and I get the following error "error in loading .dll". 

 

The ProjectWise path is in the "Path" in environment variables (same as on my machine). I'm calling the aaApi_Initialize Lib "DMSCLI.dll" in my code.   Does anyone have any clues? 

 

Many thanks

  • Not sure if this would help but I use the following code when doing Web applications ( as ASP.Net in IIS copies and runs the application from another location) calling the method when the application is started.

    [DllImport("kernel32.dll", EntryPoint = "SetDllDirectory", CharSet = CharSet.Unicode, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool SetDllDirectory(string lpPathName);

    [DllImport("kernel32.dll", EntryPoint = "SetDllDirectoryW", CharSet = CharSet.Unicode, SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    public static extern bool SetDllDirectoryW([In] [MarshalAs(UnmanagedType.LPTStr)] string lpPathName);

    [DllImport("kernel32.dll", EntryPoint = "LoadLibrary", CharSet = CharSet.Unicode, SetLastError = true)]
    static extern IntPtr LoadLibrary(string lpFileName);

    /// <summary>
    /// Loads the required ProjectWise DLL's into memory.
    /// </summary>
    /// <param name="binDir">The path to the ProjectWise Bin Directory</param>
    /// <returns>True if libraries were successfully loaded</returns>
    public static bool LoadPWLibraries(string binDir) {
    bool b = true;
    System.Diagnostics.Debug.Print("Loading required libraries");

    IntPtr ptr = LoadLibrary("kernel32.dll");
    if (ptr == IntPtr.Zero) {
    System.Diagnostics.Debug.Print("Failed to load kernel32.dll with ERROR CODE:-{0}", Marshal.GetLastWin32Error());
    b = false;
    }

    if (!SetDllDirectory(binDir)) {
    System.Diagnostics.Debug.Print("Failed to add ProjectWise Bin directory to DLL search path with ERROR CODE:-{0}", Marshal.GetLastWin32Error());
    b = false;
    }

    ptr = LoadLibrary(string.Format(@"{0}\dmsgen.dll", binDir));
    if (ptr == IntPtr.Zero) {
    System.Diagnostics.Debug.Print("Failed to load dmsgen.dll with ERROR CODE:-{0}", Marshal.GetLastWin32Error());
    b = false;
    }

    ptr = LoadLibrary(string.Format(@"{0}\dmscli.dll", binDir));
    if (ptr == IntPtr.Zero) {
    System.Diagnostics.Debug.Print("Failed to load dmscli.dll with ERROR CODE:-{0}", Marshal.GetLastWin32Error());
    b = false;
    }

    return b;
    }
  • did you try installing the redistributable package for your visual studio on the other machine?

  • Unfortunatley, this did not resolve the issue.  I have the same configuration on my machine and everything is working fine.  Do you have any other suggestions? Thanks

  • FYI.  Although I can offer little in support of our product's API in this currently unsupported configuration (that may or may not work) I did take a moment to review your Microsoft Process Monitor log and believe I know what the current problem is for why the dmscli.dll is not loading.  If you resolve this problem and have further new issues in an unsupported configuration, your best channel for assistance will be to create a new post for each new problem on the Be Communities and investigate options, opinions, or testimonials provided by the community.

    • JNBW449 is a 64-bit Windows 7, Service Pack 1 computer
    • NLNOTES.EXE is a 32-bit process, take careful note of the path "bitness" designation:
      C:\Program Files (x86)\IBM\Lotus\Notes\NLNOTES.EXE
    • The dmscli.dll you are attempting to load is the ProjectWise 64-bit version, note the path being loaded from:
      C:\Program Files\Bentley\ProjectWise\bin\dmscli.dll

    By Microsoft design, 32-bit and 64-bit binary modules cannot be intermixed in a single/common application; n.b. Microsoft drivers.

    This was evidenced in the Microsoft Process monitor log in these two frames:

    266933 11:46:50.5598648 AM 00:01:40.6903502 0.0000000 NLNOTES.EXE 32-bit 13808 40460 JNBENTLEY\0JibranK Load Image SUCCESS C:\Program Files\Bentley\ProjectWise\bin\dmscli.dll Image Base: 0xba20000, Image Size: 0x1c9000 8.5.33.12320 2/20/2014 11:46:50 AM False

    266934 11:46:50.5600021 AM 00:01:40.6904875 0.0000808 NLNOTES.EXE 32-bit 13808 40460 JNBENTLEY\0JibranK CloseFile SUCCESS C:\Program Files\Bentley\ProjectWise\bin\dmscli.dll  8.5.33.12320 2/20/2014 11:46:50 AM False

    Since Microsoft Procmon is not a Bentley product, if you need additional assistance in it usage or interpreting the log file the Microsoft forums will be most helpful.

    HTH,
    Bob



  • You may want to use Depenancy Walker from Microsoft to see if you need a Runtime dll on that machine.  I sometimes need to run a visual studio redistributable package (supplied by Microsoft) to get things to run on another machine because they dont have the runtime dll's installed.  Did not mean to walk on your post Bob. i did not see it until I had posted mine.