If you are interfacing with C++ classes, make sure that the data passed are only basic c++ types, no STL or MFC or VCL allowed in the interface.
Then, you can create a pure virtual class of the interface class, derive the interface class from the pure virtual class. Create two C functions, one that new's the MFC class but returns the interface class and one that delete from the interface pointer but actually deletes the MFC class behind it.
As a quick example (just whipped up here, not tested) of the sample .h file. This works by virtue of the virtual interface being the same between the two compilers. I do it very consistently in reverse (write code in C++Builder that can be used in an ancient MFC application written in VC6).
Interface file (included in the C++ Builder code and MFC code)
class iInterface
{
public:
virtual unsigned short __stdcall DoOneThing( char * ) = 0;
virtual long __stdcall DoTwoThing( char * ) = 0;
}
iInterface * __stdcall NewcInterface();
void __stdcall DeletecInterface( iInterface * );
MFC file included in VC side only
class cInterface : public iInterface
{
public:
unsigned short __stdcall DoOneThing( char * );
long __stdcall DoTwoThing( char * );
private:
void WhatEver( void );
bool x;
}