title: Using custom DLL with Inno-Setup
body: <p>I am having trouble getting Inno-Setup to load my DLL.
  I have looked at similar posts, but none of the solutions offered in those seem to help.In particular, <a href="https://stackoverflow.com/questions/3549977/problem-with-importing-dll-into-inno-setup">this</a> post came very close, but does not seem to be quite the same issue.</p>
  
  <p>My installer runs just fine on my test system. My DLL is written in C++, using VS 2010. There is a DEF file. I have been successful using the VS debugger to attach to the installer's thread and step through my code. Everything is good. The release version runs just fine <em>on my test system</em> with no debuggers involved. Setup calls my DLL and it works.</p>
  
  <p>Then I take my installer to a different, pristine system to try it out. Every time, when I launch the installer, it starts off with the usual UAC prompt: "Do you want to allow the following program from an unknown publisher to make changes to this computer?" And I say "Yes." Then I get a beep and an alert that says:</p>
  
  <pre><code>Runtime Error (at -1:0):
  Cannot import
  dll:&lt;utf8&gt;C:\Users\Logicrat\AppData\Local\Temp\is-4E245\MyDLL.dll
  </code></pre>
  
  <p>In my setup script I have</p>
  
  <pre><code>[Files]
  Source: "MyDLL.dll"; DestDir: "{app}"; Flags : dontcopy
  </code></pre>
  
  <p>and</p>
  
  <pre><code>function MyFunc(hWnd: Integer; lpText, lpCaption: AnsiString; uType: Cardinal): Integer;
  external 'MyFunc@files:MyDLL.dll stdcall setuponly';
  </code></pre>
  
  <p>According to the Inno documentation, the <code>dontcopy</code> flag is appropriate if the DLL is not needed for uninstall, which it is not.</p>
  
  <p>I suspect the problem lies in designating exactly where the DLL is supposed to be, as I my script calls for it to be in the <code>{app}</code> directory, yet the error message refers to a temp directory. I've tried a number of variations of the script, all with the same results.</p>
  
  <p>Both my development/test system and my pristine target system are Windows 7 (32-bit). I have been banging on this for weeks with no visible progress. Any suggestions will be most welcome.</p>