[Mono-list] P/Invoke question...

Jonathan Pryor jonpryor@vt.edu
Tue, 26 Oct 2004 17:46:56 -0400


On Tue, 2004-10-26 at 12:28, Tom Shelton wrote:
> Well, a it looks like there is more to this...  I actually am getting the
> error:
> 
> err:module:import_dll Library mscoree.dll (which is needed by
> L"F:\\dp\\test.exe") not found
> err:module:LdrInitializeThunk Main exe initialization for
> L"F:\\dp\\test.exe" failed, status c0000135

What platform are you running this on?  It looks like you have
Windows-style drives and paths, which suggests you're on Windows.

How are you executing the program?  Via "mono program.exe" or just
"program.exe"?

I suspect you're just doing "program.exe", and you DO NOT have .NET
installed.  If this is the case, the reason is because .NET assemblies
are PE-formated object files, so Windows attempts to load the .exe as a
normal program.  One of the dependent libraries is mscorlib.dll, and if
you don't have .NET installed, (1) this library won't be found, and (2)
the program won't launch, which is what you're seeing.

Bottom line, I don't think  this is a P/Invoke issue, it's an
installation issue.

Fixes: install .NET, run your program as "mono program.exe", or
contribute support to Mono so that Mono behaves like .NET on Windows
(allowing you to use "program.exe" to launch your app).

 - Jon