title: Load Oracle Instant Client at runtime
body: <p>I'm writing a Windows Forms ClickOnce application that uses the Oracle Instant Client to connect to the DB, because installing the full client on our users' machines is not an option. Unfortunately, our users have a mix of 32 and 64 bit machines. While the application itself is AnyCpu, the Oracle libraries are not.</p>
  
  <p>Right now, we are distributing two copies of the client, with the only difference being the Oracle DLLs -- 32-bit DLLs for 32-bit users, and 64-bit DLLs for 64-bit users.</p>
  
  <p>Just as an experiment, I tried releasing a client with both sets of DLLs, in separate directories, which determines the host OS's bitness at runtime and then loads the DLLs using LoadLibrary. This works, but only sort of. </p>
  
  <p>On 64-bit systems, an error box pops up saying, "The program can't start because oranls11.dll is missing from your computer". When I click "Ok" to dismiss the box, the program starts up and runs normally. Adding oranls11.dll to the list of DLLs to load causes <em>two</em> copies of the message box to pop up, one after the other.</p>
  
  <p>So, is there a better way to load the Oracle Instant Client ? If not, is there a way to suppress that message box, at least ?</p>