I have a C# application and a C++ DLL, both x86. The Application is the startup project, the DLL project is inside the same solution and is referenced as a project. The C++ DLL outputs its PDB file with the same name as the DLL inside the Debug folder of the Application.
I have a function called
[DllImport("SomeDLL.dll", EntryPoint = "SomeFunction", CallingConvention = CallingConvention.Cdecl)]
public static extern int SomeFunction(IntPtr hwnd);
#define MYDLL_API __declspec(dllexport)
MYDLL_API extern int SomeFunction(HWND hWnd);
var someAnswer = SomeFunction(_hwnd);
SomeFunctionto ensure unmanaged .dll is loaded
symbolsstatus. You can try to load
symbolsin context menu of your c++ dll in that window.
(very often happens that .net loads different (not expected) version of unmanaged .dll)
Now I'm pretty sure that the problem is that your exported function name is mangled. Try to define function like this:
extern "C" MYDLL_API int PASCAL SomeFunction(HWND hWnd);
[DllImport("SomeDLL.dll")] public static extern int SomeFunction(IntPtr hwnd);