Mixing VC6 and VC.NET 
Author Message
 Mixing VC6 and VC.NET

Hi all,

I have a DLL developed in VC.Net 7.0 and I want to use it
with clients compiled in VC 6.0.

In both cases, the settings are /MDd and no MFC.

The problem is the following:

- The VC6 client instantiates an object A defined in the
library;
- The client passes A to another object B, also defined
in the library;
- B deletes A;
- An assertion fails: _CrtIsValidHeapPointer

The code is shown below:

// In VC7 DLL
class A
{

Quote:
};

// In VC7 DLL
class B
{
    B (A* a)
    {
        delete a;
    }

Quote:
};

// In VC6 exe application
int
main (int, char**)
{
    A* a = new A;

    // Crashes here
    B b (a);

    return 0;

Quote:
}

Is there a simple way to make this work, other than
overloading operators new and delete?

Many thanks in advance,

Pedro



Tue, 06 Dec 2005 18:20:12 GMT  
 Mixing VC6 and VC.NET

Quote:

> I have a DLL developed in VC.NET 7.0 and I want to use it
> with clients compiled in VC 6.0.

> In both cases, the settings are /MDd and no MFC.

> The problem is the following:

> - The VC6 client instantiates an object A defined in the
> library;
> - The client passes A to another object B, also defined
> in the library;
> - B deletes A;
> - An assertion fails: _CrtIsValidHeapPointer

> Is there a simple way to make this work, other than
> overloading operators new and delete?

Yes - provide a function in the VC7 dll to release the instance of B,
rather than trying to use delete on it.

--
Craig Powers
MVP - Visual C++



Tue, 06 Dec 2005 21:31:35 GMT  
 Mixing VC6 and VC.NET

Quote:
>-----Original Message-----

>> I have a DLL developed in VC.NET 7.0 and I want to use
it
>> with clients compiled in VC 6.0.

>> In both cases, the settings are /MDd and no MFC.

>> The problem is the following:

>> - The VC6 client instantiates an object A defined in
the
>> library;
>> - The client passes A to another object B, also defined
>> in the library;
>> - B deletes A;
>> - An assertion fails: _CrtIsValidHeapPointer

>> Is there a simple way to make this work, other than
>> overloading operators new and delete?

>Yes - provide a function in the VC7 dll to release the
instance of B,
>rather than trying to use delete on it.

That's what I feared...

Many thanks,

Pedro



Tue, 06 Dec 2005 21:49:31 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Mixed includes with stlport and VC.NET

2. Converting VC6 to .NET 2003 VC

3. which C++ I should use, vc6, vc .net?

4. VC6 or VC.NET?

5. access violation due to bad CString copy ctor when porting from VC6 to VC7 (VC++.NET)

6. conver a VC.net solution/projects back to VC6 workspace/project

7. min/max errors when converting VC6 project to VC.NET

8. Linking library created in VC.NET from VC6.0

9. Speed (HUGE) difference between F5 debug in VC6 and VC.NET

10. what is the different between vc6.0 and vc.net

11. Problem converting VC6 ATL component to a .NET 2003 VC ATL component

12. VC6 Sample Projects won't compile in VC.NET..help please

 

 
Powered by phpBB® Forum Software