The quick answer is: because .NET platform is radically different from the unmanaged native platform you C++ application uses.
Not that those native methods exported by your DLL are not accessible or something like that; they simply make no sense. Two different kinds of code run "on different machines".
You C++ DLL code is compiled to the code using some particular
instruction-set architecture (
http://en.wikipedia.org/wiki/Instruction_set_architecture[
^]) of the CPU directly: registers, virtual memory, CPU instructions, etc.
The managed .NET code is compiled for the
CLR (Common Language Runtime,
http://en.wikipedia.org/wiki/Common_Language_Runtime[
^]). If you do not use P/Invoke, all the code is compiled into the byte code for the
virtual machine (
http://en.wikipedia.org/wiki/Common_Language_Runtime[
^]). If you also only use the target "Any CPU", your .NET code will run on any system with any other instruction set architecture where CLR in implemented.
Moreover, you can run this code
without recompilation on many other OS on different hardware, if you use some alternative CLR implementation, such as Mono (
http://en.wikipedia.org/wiki/Mono_%28software%29[
^]).
It can work this way, because the code is compiled to the target physical instruction set architecture during run time. This is called JIT —
Just-in-Time compilation, please see
http://en.wikipedia.org/wiki/Just-in-time_compilation[
^]. The time of this compilation is… well, different. In most cases, it happens on-demand, per method, when some method is about to be called for the first time.
If you think about it, you will see why the direct calls across the different platforms are not possible. That's why the special mechanism is required. In practice, two approaches are available right now: using P/Invoke or using mixed-mode (managed+unmanaged) projects: C++/CLI + native C++.
If you need to learn P/Invoke, please see:
http://en.wikipedia.org/wiki/Platform_Invocation_Services[
^],
http://msdn.microsoft.com/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp[
^].
This Code Project article can also be useful:
http://www.codeproject.com/csharp/EssentialPInvoke.asp[
^].
For C++/CLI, please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[
^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[
^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[
^].
—SA