Utils::Utils(void){}
const char* Utils::MarshalString( String ^ s ){ using namespace Runtime::InteropServices; const char* chars = (const char*) (Marshal::StringToHGlobalAnsi(s)).ToPointer(); return chars;}
tcp::endpoint Utils::MarshalEndPoint( System::Net::IPEndPoint ^endpoint ){ return tcp::endpoint(Utils::MarshalAddress(endpoint->Address), endpoint->Port);}
boost::filesystem::path Utils::MarshalFileInfo(System::String ^fullPath){ return boost::filesystem::path(Utils::MarshalString(fullPath));}
System::Collections::Generic::List<float>^ Utils::MarshalFloatVector(std::vector<float>& data){ System::Collections::Generic::List<float>^ items = gcnew System::Collections::Generic::List<float>; for(int i = 0; i < data.size(); i++) items->Add(data[i]); return items;}
BryanF wrote:I think you're being a bit myopic. Developers should have considerably fewer headaches as a result of all the technologies she talked about. Certainly the updated control library, in particular, will be welcomed.I thought it was a good interview myself. Additionally, I have to say she has some of the nicest whiteboard handwriting I've seen.
Kosher,The Marshaling lib is available in the "Orcas" March CTP.C
gsuing wrote:I haven't installed the CTP, but I'm wondering if the performance of the C++ compiler has improved. The C++ compiler in VC++2005 is quite slow compared to the VC++6.0 compiler.
Kosher wrote:Only support for strings? Uhm, that's like saying "Hey, we have this great marshaling library but it only supports strings".
I wonder what you think of the design whereby many data types could be marshaled via a single API, marshal_as<to_type>(from), as opposed to calling a different API for every conversion pair. Is the use of template syntax intuitive and natural for C++ programmers? Your opinions greatly appreciated!Thanks Sarita
PS: In your sample code in MarshalString (String ^ s ) function you could potentially be leaking memory. The IntPtr returned from StringToHGlobalAnsi must be explicitly released using FreeHGlobal or a memory leak results.