¡@

Home 

c++ Programming Glossary: marshal

Marshal C++ “string” class in C# P/Invoke

http://stackoverflow.com/questions/158628/marshal-c-string-class-in-c-sharp-p-invoke

C &ldquo string&rdquo class in C# P Invoke I have a function.. where the native string class is used Is there any way to Marshal this Am I going to have to write my own Marshaler .net c string.. any way to Marshal this Am I going to have to write my own Marshaler .net c string interop marshalling share improve this question..

Marshal C++ struct array into C#

http://stackoverflow.com/questions/188299/marshal-c-struct-array-into-c-sharp

C struct array into C# I have the following struct in C #define.. a C# struct like this public struct LPRData char 15 MarshalAsAttribute UnmanagedType.ByValTStr SizeConst 15 public string.. SizeConst 15 public string data int 15 MarshalAsAttribute UnmanagedType.ByValArray SizeConst 15 public int..

c++/cli pass (managed) delegate to unmanaged code

http://stackoverflow.com/questions/2972452/c-cli-pass-managed-delegate-to-unmanaged-code

tried creating my managed delegate and then I tried to use Marshal GetFunctionPointerForDelegate method but I couldn't compile... pointers share improve this question Yes you want Marshal GetFunctionPointerForDelegate . Your code snippet is missing.. managed gcnew ManagedSummer t Sum IntPtr unmanaged Marshal GetFunctionPointerForDelegate managed UnmanagedMethod 1 2 UnmanagedSummer..

Marshal C++ int array to C#

http://stackoverflow.com/questions/3776485/marshal-c-int-array-to-c-sharp

C int array to C# I would like to marshal an array of ints.. to marshal it into C# DllImport wrapper_demo_d.dll return MarshalAs UnmanagedType.SafeArray public static extern int fnwrapper_intarr.. IntPtr ptr fnwrapper_intarr int result new int 3 Marshal Copy ptr result 0 3 You need also to write Release function..

What is the best way to convert between char* and System::String in C++/CLI

http://stackoverflow.com/questions/56561/what-is-the-best-way-to-convert-between-char-and-systemstring-in-c-cli

Stan Lippman's blog but it's from 2004. I have also seen Marshal StringToHGlobalAnsi . Is there a method that is considered best..

.NET System::String to UTF8-bytes stored in char*

http://stackoverflow.com/questions/6596242/net-systemstring-to-utf8-bytes-stored-in-char

unicodeString Get pointer to unmanaged char array int size Marshal SizeOf encodedBytes 0 encodedBytes Length IntPtr pnt Marshal.. SizeOf encodedBytes 0 encodedBytes Length IntPtr pnt Marshal AllocHGlobal size Marshal Copy encodedBytes 0 pnt encodedBytes.. 0 encodedBytes Length IntPtr pnt Marshal AllocHGlobal size Marshal Copy encodedBytes 0 pnt encodedBytes Length Ugly but necessary..

Create WCF service for unmanaged C++ clients

http://stackoverflow.com/questions/686452/create-wcf-service-for-unmanaged-c-clients

from managed string back to unmanaged string IntPtr ptr Marshal StringToHGlobalAnsi message rv std string reinterpret_cast char.. rv std string reinterpret_cast char static_cast void ptr Marshal FreeHGlobal ptr catch Exception ^ client Abort return rv The..

C++/CLI Converting from System::String^ to std::string

http://stackoverflow.com/questions/946813/c-cli-converting-from-systemstring-to-stdstring

this question Check out System Runtime InteropServices Marshal StringToCoTaskMemUni and its friends. Sorry can't post code..

passing an array of structs from c# to C++ using com callable wrapper

http://stackoverflow.com/questions/12503041/passing-an-array-of-structs-from-c-sharp-to-c-using-com-callable-wrapper

from c# and use it in c . thanks in advance. c# c com marshalling share improve this question The problem with returning.. and have no information about array size. You can try to marshal it as a SAFEARRAY but IMO SAFEARRAYs are pain in the neck. I.. CharSet.Unicode public struct MyStruct public int Value I marshal strings as arrays see note at the bottom MarshalAs UnmanagedType.ByValTStr..

Convert inline assembly code to C++

http://stackoverflow.com/questions/16142284/convert-inline-assembly-code-to-c

it takes N arguments in order to be able to correctly marshal args from an anycall type wrapper like the above. In 64bit mode..

CoCreateInstance returning E_NOINTERFACE even though interface is found

http://stackoverflow.com/questions/1781906/cocreateinstance-returning-e-nointerface-even-though-interface-is-found

you make calls to your interface. This process is called marshaling . If you define a custom interface you need to implement.. . If you define a custom interface you need to implement marshaling for it using one of the following approaches. Standard marshaling.. for it using one of the following approaches. Standard marshaling have the MIDL compiler to generate a proxy and stub which..

Marshal C++ int array to C#

http://stackoverflow.com/questions/3776485/marshal-c-int-array-to-c-sharp

C int array to C# I would like to marshal an array of ints from C to C#. I have an unmanaged C dll which.. DLL_EXPORT int fnwrapper_intarr I am then using pinvoke to marshal it into C# DllImport wrapper_demo_d.dll return MarshalAs UnmanagedType.SafeArray.. execution I get the following error SafeArray cannot be marshaled to this array type because it has either nonzero lower bounds..

Creating a basic C++ .dll for p/invoke in C#

http://stackoverflow.com/questions/4679858/creating-a-basic-c-dll-for-p-invoke-in-c-sharp

this question The third parameter needs to be a byte marshalled as a char of size 16. If you check the documentation for.. a 16 byte array. The runtime should be perfectly happy to marshal a byte of size 16. Be careful not to mix C char with C# char..

C# Marshalling double* from C++ DLL?

http://stackoverflow.com/questions/5072340/c-sharp-marshalling-double-from-c-dll

0 0 0 0 I get a MarshalDirectiveException exception Cannot marshal 'return value' Invalid managed unmanaged type combination. I'm.. rather than a MarshalDirectiveException. c# c interop marshalling dllimport share improve this question There are a few.. The C code has no idea how big those arrays are. The marshaller will pass them a valid pointer but without a corresponding..

In-Proc COM object sharing across another Process

http://stackoverflow.com/questions/5425770/in-proc-com-object-sharing-across-another-process

process look up that object. The other approach is to use marshaling. Marshaling is the process of using a COM API to get a series.. and then use another COM API in the receiving process to unmarshal the object COM then creates a suitable remoting proxy in that.. one. Check out the APIs CoMarshalIntefcace and CoUnmarshalInterface for more details. Note that both of these require that..

How do I marshal wchar_t* from C++ to C# as an out parameter or return value?

http://stackoverflow.com/questions/6089214/how-do-i-marshal-wchar-t-from-c-to-c-sharp-as-an-out-parameter-or-return-valu

do I marshal wchar_t from C to C# as an out parameter or return value I.. value from a function to the C# level. c# .net c interop marshalling share improve this question This isn't as difficult.. to the LPWSTR type defined in windows.h . So you marshal it as a string type. However since it's an out parameter or..

Create WCF service for unmanaged C++ clients

http://stackoverflow.com/questions/686452/create-wcf-service-for-unmanaged-c-clients

message client SayHello gcnew String name client Close marshal from managed string back to unmanaged string IntPtr ptr Marshal..

Best way to call Managed .NET code from Unmanaged code

http://stackoverflow.com/questions/8406400/best-way-to-call-managed-net-code-from-unmanaged-code

in gcroot T fields. Use the clr interop funcionality to marshal back and forth between managed unmanaged code google or bing.. forth between managed unmanaged code google or bing for marshal_as . Provide an unmanaged factory function which creates an..