Only support for strings? Uhm, that's like saying "Hey, we have this great marshaling library but it only supports strings". LOL
That's not really a library but more like a code snippet. Don't get me all excited about interop then give me something so trivial. Is something wrong with the code below?
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;
}