Dynamically importing a C++ class from a DLL

前端 未结 5 1993
失恋的感觉
失恋的感觉 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:52

    I normally declare an interface base class, use this declaration in my application, then use LoadLibrary, GetProcAddress to get the factory function. The factor always returns pointer of the interface type.

    Here is a practical example, exporting an MFC document/view from a DLL, dynamically loaded

提交回复
热议问题