首页 > 解决方案 > 如何修复“无法在 DLL 'y' 中找到名为 'x' 的入口点”

问题描述

我花了至少 3 个小时试图弄清楚为什么这不起作用。一些背景是,我正在尝试通过为名为 Assault Cube 的游戏编写一些技巧来提高我在 c# 和 c++ 中的编码技能。我正在尝试从我的 c++ dll 调用 c# 中的函数。

我的 C# 代码:

        [DllImport("CortexAPI.dll")]
        static extern void gameCheck();

我的 C++ 代码:

class cortexFunctions{

        __declspec(dllexport) static void gameCheck()
        {
            /*finds ac window*/
            string AC = "ac_client.exe";

            std::wstring convertac = std::wstring(AC.begin(), AC.end());/*plz find out how to do this without converting :)*/
            LPCWSTR assaultcube = convertac.c_str();

            HWND assaultclient = FindWindow(0, assaultcube);
            /*end of finding ac client*/

            /*If assault cube is open, then outputs that the exploit is working fine*/
            if (assaultclient == 0) {
                MessageBox(NULL, TEXT("Assault Cube is not open."), TEXT("Open Assault Cube"), 0);
            }
            else {
                MessageBox(NULL, TEXT("Cortex is working fine!"), TEXT("Good!"), 0);
            }
        }
    };

请我尝试了很多不同的解决方案,但它们总是不起作用或导致另一个问题。

标签: c#c++

解决方案


推荐阅读