|
-
November 2nd, 2011, 03:37 AM
#1
Pass CObject derived class between DLL calls
Hi,
I define a CObject derived class called CMyClass, as follows:
class CMyClass : public CObject
{
..
}
Then I define two DLLs, DLL1.dll and DLL2.dll
DLL1.dll contains an export function called CreateMyClass, as follows:
CMyClass *CreateMyClass()
{
CMyClass *pMyClass;
pMyClass = new CMyClass;
return pMyClass;
}
DLL2.dll contains an export function called UseMyClass, as follows:
void UseMyClass(CMyClass *pMyClass)
{
if (pMyClass != NULL)
{
// Statements to use pMyClass
}
}
Then I want to build a third MFC application called MyApp.exe that will contain the following statements:
CMyClass *pMyClass;
// Invoke CreateMyClass in DLL1.dll to create a new instance of CMyClass
pMyClass = CreateMyClass();
// Invoke UseMyClass to use pMyClass
UseMyClass(pMyClass);
For MyApp.exe, DLL1.dll and DLL2.dll, I want to statically link the MFC library. Is that possible? Also are there any special requirements or attention need to pay when create and build these three projects?
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|