Hello everyone!
I have a following situation: I need to import into my Visual Studio 2019 C++ project (call this A) methods from another very very big project (call this B). Actually I have a .sol file for this B project and could succesfully build static library (B.lib) as well as dynamic (B.dll). A problem is - I want to call some methods from B in A but i couldn't just load a header of B and create some class in A, which inherits the needed class in B with all needed methods, because B is really a very big project, and in the "main header" there are used lots of self-defined classes, which are just incorporated into project, and I will be really stuck trying to import a header, in order to make header work, in order to make the "main" header work in my project etc. I think you got the idea.
The second thing is more concrete: I tried to load DLL with LoadLibrary
and GetProcAdress
. It works. Actually in B for all methods, which I really need, it is defined a void external version of each of them, which takes a pointer to the class object as a parameter. A question is - how to get the instance of this class if there is no factory function in B - i.e. function returning this needed class object's pointer, which I could load from .dll into my A? I couldn't attach a proper code, since it is cw protected. Maybe it will be possible with .lib file? How do thois pair of things work together, that's really my question.
So, is there any way how I could get the methods from those libraries? Please explain more in detail, if you have time, I'm a junior in C++ development and I don't always clearly get what does it mean smth. like "just link .lib file and use it" - how to use?.. and so on
Thanks in advance for help!