Dynamically importing a C++ class from a DLL

前端 未结 5 2004
失恋的感觉
失恋的感觉 2020-12-31 06:34

What is the correct way to import a C++ class from a DLL? We\'re using Visual C++.

There\'s the dllexport/exports.def+LoadLibrary+GetProcAddress trifecta, but it do

5条回答
  •  星月不相逢
    2020-12-31 06:59

    Check out this question. Basically, there are two ways. You can mark the class using _dllexport and then link with the import library, and the DLL will be loaded automatically. Or if you want to load the DLL dynamically yourself, you can use the factory function idea that @titanae suggested

提交回复
热议问题