marshal_as library in VC2008

The VC++ team added a (simple) marshal_as library in VC2008. But this library only supports simple datatypes like

  • String^ to char* / wchar_t* / BSTR / bstr_t / CComBSTR / std::string / std::wstring / CString<char> / CString<wchar_t>  and vice versa
  • IntPtr to HANDLE  and vice/versa

So, the support only contains “Strings” and “Handle”. But this are the most commonly needed scenarios for marshaling.
The usage of some of the string marshaling is shown here:

An overview of the build-in marshaling can be found here: Overview of Marshaling in C++

There is a website (, in which you can look-up additional marshaling implementations like:

Hopefully many, more will follow…
If you have an implementation of some kind of “marshal_as”, just put a comment to Kate Gregory

2 thoughts on “marshal_as library in VC2008

  1. Venson

    I have the problem that my compiler allways say:

    fatal error C1083: Datei (Include) kann nicht geöffnet werden: “msclr/marshal.h”: No such file or directory

    can u help me please?

Comments are closed.