When debugging using the environment variable "The program cannot start due to a missing DLL"

I get the error mentioned below when an error occurred while debugging the executable in Delphi XE2 update 4 under the following circumstances:

  • which depends on mqic.dll from WebShpere, which is located in C:\Program Files \IBM\WebSphere MQ\bin\mqic.dll and C:\Program Files\IBM\WebSphere MQ\bin , is on the system path (not on the way user).
  • debugged with redefined environment variable in Run Parameters Debugger Environment Block User overrides
  • Including System Variables on the same property page is checked

This is an error (this is an error loading the Windows DLL labeled "System Error").

The program does not start because mqic.dll is missing from your computer. Try reinstalling the program to fix this problem.

A few notes:

  • I am debugging as a normal user (this is normal practice, since in this case I cannot be an administrator due to the policy on the client).
  • As soon as I delete the environment variable, it works (but the barfs program, since it really needs information).
  • Setting an environment variable before starting Delphi is cumbersome, but feasible as a temporary workaround (I need to change this variable often during debugging in order to test different scenarios, Delphi's on / off time makes it tedious).
  • I can not do without an environment variable, because it is necessary for an application that does not have source code and cannot be rewritten in time for its gradual failure.

This shows the event log:

 Faulting application name: CAS400NTMQ.exe, version: 1.1.4639.52512, time stamp: 0x50508180 Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec49b60 Exception code: 0xc0000005 Fault offset: 0x0005333f Faulting process id: 0x4b20 Faulting application start time: 0x01cd90e36bb90816 Faulting application path: C:\Users\...\bin\CAS400NTMQ.exe Faulting module path: C:\Windows\SYSTEM32\ntdll.dll Report Id: a9853965-fcd6-11e1-ae66-78e3b5ca2514 

Question: is there a different solution or a lighter workaround than what I use above?

+4
source share
2 answers

Something is wrong with Delphi XE2 processing with overridden user environment variables. Take an example application:

 program Project1; {$APPTYPE CONSOLE} uses System.SysUtils; begin Writeln(GetEnvironmentVariable('PATH')); Readln; end. 

This makes the path fine when exiting the debugger or when there is no overridden user environment variable. But as soon as you enter the environment variable in Run-> Parameters-> Environment Block, it displays an empty string.

A possible workaround is to override the required variable, in this case "PATH". The program can then output (and possibly use) the correct path. Obviously, this is a fairly limited workaround. When you use user redefinition, it is not only "PATH" that you lose. The FI example program still will not be able to output "APPDATA".

Previous versions of Delphi do not seem to have this problem. There QC report: Enable system variables no longer works , which is closed as "fixed" in assembly 17.0.4625.53395.

+5
source

According to the latest blog post by Andreas Hausaden and his answer here , IDEFixPack will take care of this XE2 error. And not required in XE3, because XE3 fixes the problem.

Therefore, I suspect that this may be the most effective way if you manage to get the IDEFixPack installed on this computer. Even if you cannot install IDEFixPack, this answer may still be useful to other readers.

+6
source

Source: https://habr.com/ru/post/1433825/


All Articles