[Mono-list] DllNotFoundException

Mikro Trekker mtrekker at hot.ee
Mon Jul 13 06:46:30 EDT 2009

I am using Mono 2.4 on Vista. Project executable (C#) works fine on
Windows platform. All managed DLLs that EXE is using reside in the same
directory where EXE is located.

When I try to run EXE then I get DllNotFoundException ?

For testing purposes I wrote a managed DLL (pinvoke.dll - see code
below) that uses LoadLibrary to load DLLs my EXE uses. When calling
pinvoke.dll inside my C# EXE I get LoadLibrary error 182. Any
explanation ?

#include <stdio.h>
#include <windows.h>

extern "C" __declspec(dllexport) void TestInvoke(const char *dll, const
char *msg)
    if( LoadLibrary( dll ) ) 
        MessageBox( NULL, "LoadLibrary Ok!", msg, 0 );
        DWORD err = GetLastError();
        char szBuf[128] = {0};    
        _snprintf( szBuf, sizeof(szBuf), "LoadLibrary failed: %d", err
        MessageBox( NULL, szBuf, msg, 0 );

More information about the Mono-list mailing list