Is there a better way to load a dll in C++?

前端 未结 7 1344
北海茫月
北海茫月 2020-12-13 16:46

Right now I do something like this and it seems messy if I end having a lot of functions I want to reference in my DLL. Is there a better and cleaner way of accessing the fu

7条回答
  •  一整个雨季
    2020-12-13 16:55

    Import libraries (.lib) simplify DLL usage in user code, see e.g. here for a basic tutorial.
    They spare the users from loading the DLL, using GetProcAddress() and function pointers themselves - they statically link to the import library instead which does the work for them.

提交回复
热议问题