14 #ifndef _INC_MSCLR_MARSHAL_WINDOWS
15 #define _INC_MSCLR_MARSHAL_WINDOWS
35 BSTR _bstr = _from_object.
copy(
false);
41 return System::Runtime::InteropServices::Marshal::PtrToStringBSTR(System::IntPtr(_bstr));
47 if (_from_object ==
nullptr)
54 _ret_bstr_t.
Attach(::SysAllocStringLen(_pinned_ptr, _from_object->Length));
57 throw gcnew System::InsufficientMemoryException();
65 return System::IntPtr(_from_object);
68 template <
class _To_Type>
69 inline _To_Type
marshal_as(System::IntPtr _from_object);
74 return static_cast<HANDLE>(_from_object.ToPointer());
90 _ip = System::Runtime::InteropServices::Marshal::StringToBSTR (from);
91 _to_object =
static_cast<BSTR
>(_ip.ToPointer());
102 if(_ip != System::IntPtr::Zero)
103 System::Runtime::InteropServices::Marshal::FreeBSTR(_ip);
Definition: comutil.h:144
Definition: appdomain.h:36
void Attach(BSTR s)
Definition: comutil.h:597
#define NULL
Definition: crtdbg.h:30
__const_Char_ptr PtrToStringChars(__const_String_handle s)
Definition: vcclr.h:40
BSTR copy(bool fCopy=true) const
Definition: comutil.h:545
Definition: marshal.h:244
_To_Type marshal_as(_In_z_ const char _from_object[])
Definition: marshal.h:187
System::IntPtr _ip
Definition: marshal_windows.h:86
Definition: marshal.h:201
context_node(BSTR &_to_object, System::String^from)
Definition: marshal_windows.h:88
void * HANDLE
Definition: concrt.h:66
~context_node()
Definition: marshal_windows.h:94