J
J
Jomm2021-07-26 23:45:54
C++ / C#
Jomm, 2021-07-26 23:45:54

Unable to load DLL (Module could not be found HRESULT: 0x8007007E)?

I'm trying to import my dll written in c++.

[DllImport(@"..\..\baselib\Release\baselib.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int BT7274(int a, int b);
static void Main(string[] args)
{
   BT7274(1, 2);
}

On startup it gives an error:
System.DllNotFoundException: 'Unable to load DLL 'baselib.dll' or one of its dependencies: 
The specified module could not be found. (0x8007007E)'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vasily Bannikov, 2021-07-27
@Jomm

You can't seem to use relative paths. Just write baselib.dll and put it next to the executable

S
Stanislav Makarov, 2021-07-27
@Nipheris

or one of its dependencies

Does baselib.dll have its own dependencies? Well, show what you can see in Dependencies .
And yes, in any case, the library should be put next to the exe, you can set up a build rule for this.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question