Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Marshalling   (RSS)

How to check if my code is executing inside a Managed App or Native App?

If you check the CRT source code (inside VC\crt\src\crt0.c ) you can find an interesting function check_managed_app() that returns 1 if managed app, 0 if not based on the COM Runtime Descriptor in the Image Data Directory of the PE or PE+ header. You

How to return String-Arrays from C++ COM component to C#?

Want to return an array of strings from native COM component to managed code? You need to declare the string array as SAFEARRAY(VARIANT) in the COM code. IDL for the function that returns the array of strings for the COM component would look like, [ id

How to Modify Managed Strings in Native Code?

Want to modify a managed string passed to a native function? I collected two ways of doing it. Either you can use System::Text::StringBuilder mechanism or you can use the array method mentioned at http://msdn2.microsoft.com/en-us/library/s04yfy1s(VS.80).aspx
 
Page view tracker