MFC CStringList and Managed C++ 
Author Message
 MFC CStringList and Managed C++

Hi,

I am writing a managed wrapper around an existing
unmanaged DLL.

One unmanaged method has all MFC's CStringList&
parameters.  The unmanaged method returns successfully  
but when the wrapper managed method returns there is a
memory exception.  Apparetnly it is originating  in
CStringList destructor - RemoveAll().  

bool CMcpp::GetVals(ArrayList* names,  
                           ArrayList* Type,
                       ArrayList* Description,  
                           ArrayList* Units)
{

        CStringList names, type, descr, units;
        bool bResult = pUcpp->GetSignals(sigs, data,
descr, units);  
        if(bResult)    
        {
                //code to copy CStringList to ArrayList
goes here
        }      

        return bResult;

Quote:
}

Please provide some help on using CString & and related
arrays and lists in Managed C++.

Thank you.



Mon, 03 Oct 2005 20:47:10 GMT  
 MFC CStringList and Managed C++
Did you try using the new/delete operator to create and destroy CStringList
objects? Not sure if it works. But you may give it a try.

Thanks,
-Allen

Disclaimer:
This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net?  http://www.gotdotnet.com

--------------------
| Content-Class: urn:content-classes:message


| Subject: MFC CStringList and Managed C++
| Date: Thu, 17 Apr 2003 05:47:10 -0700
| Lines: 33
|
| Hi,
|
| I am writing a managed wrapper around an existing
| unmanaged DLL.
|
| One unmanaged method has all MFC's CStringList&
| parameters.  The unmanaged method returns successfully  
| but when the wrapper managed method returns there is a
| memory exception.  Apparetnly it is originating  in
| CStringList destructor - RemoveAll().  
|
| bool CMcpp::GetVals(ArrayList* names,  
|                          ArrayList* Type,
|                      ArrayList* Description,  
|                          ArrayList* Units)
| {
|
|       CStringList names, type, descr, units;
|       bool bResult = pUcpp->GetSignals(sigs, data,
| descr, units);        
|       if(bResult)    
|       {
|               //code to copy CStringList to ArrayList
| goes here
|       }      
|
|       return bResult;
| }
|
| Please provide some help on using CString & and related
| arrays and lists in Managed C++.
|
| Thank you.
|



Tue, 04 Oct 2005 17:54:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. migrating MFC application to Managed C++

2. are MFC and Managed C++ compatible ?

3. MFC App + Managed C++ : Release compiles, Debug DOESN'T (operator new issue)

4. using Managed dlls from Managed C++

5. MFC CstringList and ATL

6. MFC CstringList and ATL

7. managed C++ wrapper around unmanaged C++ classes: causing StackOverflow exception

8. Performance of unmanaged C++ in a managed C++ app

9. Redirected - Managed C++, differences from standard C++

10. Fatal Error C1010 in Mixing Managed C++ and Unmanaged C++ Code

11. Inherit unmanaged c++ classes from .Net platform (managed c++ or c#)

12. C# client crashs when calling into Managed C++ which calls unmanaged c++ function

 

 
Powered by phpBB® Forum Software