简体   繁体   English

未找到入口点

[英]Entry Point Not Found

I am encountering a weird error when attempting to run an application (which I haven't changed the code for for a while as it works okay) linking to my DLL.我在尝试运行链接到我的 DLL 的应用程序时遇到一个奇怪的错误(我有一段时间没有更改代码,因为它工作正常)。 This DLL used to work, but I've been making changes to the DLL's code and got it to compile okay.这个 DLL 曾经可以工作,但我一直在对 DLL 的代码进行更改并使其编译正常。 Unfortunately, when trying to run the application...不幸的是,在尝试运行应用程序时...

---------------------------
GameTest001.exe - Entry Point Not Found
---------------------------
The procedure entry point ??0Music@@QAE@ABV0@@Z could not be located in the dynamic link library Renderer02.dll. 
---------------------------
OK   
---------------------------

I have no idea how to interpret this error.我不知道如何解释这个错误。 I know what changes I have made, and my code looks fine to me.我知道我做了什么改变,我的代码看起来很好。 I've tried Googling this and had no luck at all.我试过谷歌搜索这个,但根本没有运气。

Can anyone shed any insight to this?任何人都可以对此有所了解吗? What does this error mean?这个错误是什么意思?

You are linking to a function that has been exported with a mangled name, and that name is ??0Music@@QAE@ABV0@@Z .您正在链接到一个以错误名称导出的函数,该名称是??0Music@@QAE@ABV0@@Z The DLL that is being loaded does not export a function of that name and hence the error.正在加载的 DLL 不会导出该名称的函数,因此会出现错误。

The name mangling encodes the function's name, parameters and return value.名称修饰对函数的名称、参数和返回值进行编码。 So the most likely cause for the mismatch is that you have changed the name, parameters or return value of the function in one place but not the other.因此,导致不匹配的最可能原因是您在一处更改了函数的名称、参数或返回值,而在另一处未更改。

If you have changed the DLL you'll need to re-compile it to produce new .lib and .dll files.如果您更改了 DLL,则需要重新编译它以生成新的 .lib 和 .dll 文件。 You will also have modified the .h file.您还将修改 .h 文件。 Make sure that the modified versions of all three of those files are used by the program that links to the DLL.确保链接到 DLL 的程序使用所有这三个文件的修改版本。

This error message is actually helpful to you because it will make sure that both sides of the interface match before you can proceed to execute the code.此错误消息实际上对您很有帮助,因为它会确保接口的两端匹配,然后您才能继续执行代码。

Update更新

I didn't make it clear enough in the text above.我在上面的文字中没有说得足够清楚。 Whenever you change the interface of the DLL you must do the following:每当您更改 DLL 的接口时,您必须执行以下操作:

  1. Update any .h files that are used by the application.更新应用程序使用的任何 .h 文件。
  2. Re-compile the DLL to produce new .lib and .dll files.重新编译 DLL 以生成新的 .lib 和 .dll 文件。
  3. Re-compile the application using the updated .lib and .h files.使用更新的 .lib 和 .h 文件重新编译应用程序。
  4. Distribute the new .dll file so that the updated application loads the updated DLL.分发新的 .dll 文件,以便更新的应用程序加载更新的 DLL。

It seems the function Music::Music(class Music const &) is missing from your dll.您的 dll 中似乎缺少Music::Music(class Music const &) ??0Music@@QAE@ABV0@@Z is the mangled name for this function. ??0Music@@QAE@ABV0@@Z是这个函数的重命名。 You can demangle function names using this site .您可以使用此站点对函数名称进行解构。

再次查看编译器标志以检查是否包含-static-libstdc++。在这种情况下,您必须重建应用程序。

Try this in your c++ code在你的 C++ 代码中试试这个

extern "C"
{
   inline  __declspec(dllexport)  int MyFunction()
  {
     return  63;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM