Use methods of DLLs into other ones
I have 3 DLLS and one win32 project in the s开发者_如何学编程ame solution. The win32 project should use methods and classes of the DLLs and the DLLs should use methods of the other ones.
How can I do this? Should I include the .h files of every DLLs in the other ones?
Also, I have a function in one DLL that initialize a class defined in the header file of the DLL, how can I call it in the win32 project so that it creates the instance but valid also for the others DLLs?
I don't quite understand what your problem is. You link to DLLs using header and lib files. I think you already know this.
If you want to share an instance between code in different DLLs you need to export that instance just like you export the classes and functions. You can export the symbol directly, or provide a function to obtain a reference to the instance.
You seem to be saying that DLL A refers to DLL B and vice versa. In which case, despite your protestations to the contrary in the comments, it would be easier to combine them into one DLL.
精彩评论