How to check a DLL if a function exists?

后端 未结 2 1061
醉梦人生
醉梦人生 2020-12-10 07:58

I\'m working on something which dynamically loads specially formulated DLL\'s. I need to be able to check the DLL and make sure all the expected functions exist before I con

2条回答
  •  忘掉有多难
    2020-12-10 08:33

    You have to use LoadLibrary, and then use GetProcAddress for each function you want to check existence for. There's really no other reasonable choice (unless there are specific reasons you need to avoid`LoadLibrary). Since your intent seems to be just to check to see if the functions are present and nothing more, LoadLibrary and GetProcAddress are the simplest means to do so; you can do all of the work in very few lines of code, and error checking is extremely simple and straightforward.

提交回复
热议问题