<p>I am building on C++ dll, by writing code in C#.</p>

<p>I get an error, saying </p>

<blockquote>
  <p>LoaderLock was detected Message:
  Attempting managed execution inside OS
  Loader lock. Do not attempt to run
  managed code inside a DllMain or image
  initialization function since doing so
  can cause the application to hang.</p>
</blockquote>

<p>I tried seraching what this error exactly means, but I am drawing pointless articles, mostly saying that it's just a warning, and I should switch that off in Visual Studio.
The other solutions seem to be due to ITunes, or this problem occurring when programming with DirectX. My problem is connected to neither.</p>

<p>Can anybody explain, what this actually means?</p>

The general idea of loader lock:
The system runs the code in DllMain inside a lock (as in - synchronization lock). Therefore, running non-trivial code inside DllMain is "asking for a deadlock", as described
here
.
The question is, why are you trying to run code inside DllMain? Is it crucial that this code run inside the context of DllMain or can you spawn a new thread and run the code in it, and not wait for the code to finish execution inside DllMain?
I believe that the problem with manged code specifically, is that running managed code might involves loading the CLR and suchlike and there's no knowing what could happen there that would result in a deadlock... I would not heed the advice of "disable this warning" if I were you because most chances are you'll find your applications hangs unexpectedly under some scenarios.