Calling MFC Lib from C# using Wrapper classes

G

Guest

I have an MFC static lib which exports som classes, it still needs to be
available to MFC apps and now C# apps as well. For C# I am creating a wrapper
dll that will link in the library. My question is for the function
ProcessStructs which takes a CTypedPtrArray pointer as a parameter. Are my
steps below correct or is there an easy way to do this?

Redefine my struct to .Net compatible version in my wrapper class
Would I have to make my wrapper function take a .Net array ref and then
convert it over to a CTypedPtrArray?
Call my MFC function ProcessStructs
Copy the structs back to my .Net array before returning from my wrapper
function?

Original MFC class sample

class CMFCTest
{
public:
struct TestStruct
{
CString str1;
CString str2;
int nCnt;
}
void ProcessStructs(CTypedPtrArray<CPtrArray, TestStruct*>* pStructs);
}


Thanks
Kurt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top