I\'m trying to call from C# a function in a custom DLL written in C++. However I\'m getting the warning during code analysis and the error at runtime:
War
Well, you know the entry point name, use the EntryPoint = "?SetHook@@YA_NXZ" property in the [DllImport] attribute. Or put extern "C" before the declaration in your C++ code so the name doesn't get mangled.
[DllImport("wi.dll", EntryPoint = "?SetHook@@YA_NXZ", CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAsAttribute(UnmanagedType.I1)]
internal static extern bool SetHook();