简体   繁体   中英

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. This DLL used to work, but I've been making changes to the DLL's code and got it to compile okay. 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 . The DLL that is being loaded does not export a function of that name and hence the error.

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. You will also have modified the .h file. Make sure that the modified versions of all three of those files are used by the program that links to the 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:

  1. Update any .h files that are used by the application.
  2. Re-compile the DLL to produce new .lib and .dll files.
  3. Re-compile the application using the updated .lib and .h files.
  4. Distribute the new .dll file so that the updated application loads the updated DLL.

It seems the function Music::Music(class Music const &) is missing from your dll. ??0Music@@QAE@ABV0@@Z is the mangled name for this function. You can demangle function names using this site .

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

Try this in your c++ code

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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