better way to use strings in managed and unmanaged code 
Author Message
 better way to use strings in managed and unmanaged code


Use Marshal.StringToHGlobalAuto method to get a pointer, in the unmanaged
heap, to the unmanaged version of the managed string. Now, you are
reponsible for releasing that memory.

"French is the language of love, C# is for everything else..."

> i am upgrading an application,
> as a step one i changed one of the core class to __gc and updated its
> properties etc.

> now if i expose string properties as System::String it gives hard time to
> all other classes those uses it. beacuse then i have to change each part
> contverting between CString and System::String and replacing use ==
> with System::String::Compare or otherwise i have to conver String in to

> the problem with pointer is who going to unallocate it, is there a nicer
> to handel this situation any suggestion.

> Thanks,
> Sajjad

Wed, 26 Jan 2005 16:28:59 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Debugging into managed c++ DLL that is being used by unmanaged code

2. Possible vc++ bug: using c++ references to managed objects in unmanaged code

3. Referencing data from unmanaged code to managed code in C++ Wrapper class

4. calling managed code from unmanaged code

5. Calling managed code from unmanaged Code

6. Good ways to obfuscate/mangle strings?

7. conversion from managed System::String to unmanaged UUID?

8. Managed String to unmanaged

9. Converting managed String to unmanaged char*

10. Managed and unmanaged strings

11. Creating a .NET managed library to talk to existing unmanaged code

12. Managed c++ with unmanaged code Linking problem...


Powered by phpBB® Forum Software