Question

I have two Visual C++ projects (in Visual Studio 2008 environment) and one of them has to use the others classes and functionalities. So I found this which is pretty understandable but I have one point that needs clarification.

So let's say first project is ProjA and the second one is ProjB. ProjB needs to use the classes and funcs. of ProjA as I told in beginning. But there must be only one interface between these two projects which is a simple object like this:

class A
{
public:
   void write(data);
   void read (data);
}

so this must be the interface class which ProjB has to use, but in ProjA after write function is called there are a lot of oprations are done in seperate cpp files and other classes and funcs...

So my question is do I need to use dllexport functionalities only for class A or do I have to use them in all the other class and function definitions which are used inside ProjA as well? And how to write the interface file?

Thanks indeed...

Was it helpful?

Solution

Use dllexport only for the A class, provided that the type of the data parameter is not another class defined in ProjA.

When a class is "exported", all the code for that class is ans stays in it's DLL. If the ProjB knows nothing else from the ProjA classes, it should works.

Be sure to keep the two Dlls in sync (build otions, type of C RunTime...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top