Reputation: 1
I want to make an C++ application which is highly expandable. The basic idea is a main application which contains of some basic functionality and the application life cycle (when what is executed). This main application can be extended with dll's.
Let's assume there is a folder for the main application where you can put your dll's. When you start the main application it loads these and execute implemented functionality in these dll's.
What is the best approach to this (preferred without frameworks or other dependencies)?
My thoughts were to load dynamically dll's. Theses dll's implement some abstract Classes/Interfaces, so that the main application can work with these abstract Classes/Interfaces and the specific implementation is in the dll's.
Upvotes: 0
Views: 145
Reputation: 2554
In Fruit* f = (Fruit*)GetProcAddress(concreteLib, "CreateModule");
you are getting the CreateModule
function address, not calling it.
You have to create a function pointer and call it. (Not compiled example.)
typedef Fruit* (*CreateModuleFunc)(void);
CreateModuleFunc CreateModule = GetProcAddress(concreteLib, "CreateModule");
Fruit* f = CreateModule();
f-> // whatever
Upvotes: 1