Category : marshalling

i want to pass some data from a c++ dll to c#,and run it on android. but i face a lot of problems. If i use the code such as: byte[] character = new byte[lenth]; Marshal.Copy(intptr,character,0, lenth);//copy the data in the memory which intptr direct to System.Text.Encoding gb2312 = System.Text.Encoding.GetEncoding("gb2312"); byte[] cvt_character = System.Text.Encoding.Convert(gb2312, System.Text.Encoding.Unicode, ..

Read more

I’m currently trying to extend the functionality of the NVIDIA CloudXR client app for HoloLens2 to perform ArUco marker tracking. The C++/WinRT app of the client app is initialized using MTA. The CloudXR functionality is provided using two .dlls. I’ve included the ArUco tracking capability in a separate Windows Runtime Component which the client app ..

Read more

first delegate System.Text.StringBuilder get_content_func(uint i); then get_content_func func = _content; System.IntPtr p = Marshal.GetFunctionPointerForDelegate(func);//error – stack over flow and the ‘p’ will be register to c++ ,and will be callback at some time to get the string content . the purpose is to get the string from method ‘_content ‘which is used to send to ..

Read more

I’m wrapping some old C++ code into C# and I’ve hit a snag. I have the following structures: In C++: typedef struct tagEIPCIPTAGDBACCESS { char * tagName; WORD opType; DWORD daType; DWORD eleSize; DWORD numEle; void * data ; void * wrMask; int result; } EIPCIPTAGDBACCESS; and in C# I have built it as: public ..

Read more

I’m trying to send a native c++ short array to c# side via masrhalling: delegate void OnMoreDataInter( [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] short[] moreData, int moreDataSize); This code works perfectly in Windows and Android. However, the returned array size is always 1 on C# side for iOS. I have applied the approach in the topic: ..

Read more

I’m trying to send a native c++ short array to c# side via masrhalling: delegate void OnMoreDataInter( [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] short[] moreData, int moreDataSize); This code works perfectly in Windows and Android. However, the returned array size is always 1 on C# side for iOS. I have applied the approach in the topic: ..

Read more

I am trying to use the Hikvision SDK https://www.hikvision.com/en/support/download/sdk/ My current goal is to open the door (trigger an output) with the intercom outdoor station. I managed to do the login (NET_DVR_LoginV40) and display the outdoor station’s camera feed. My next step would be to open the door. For this I need to call the ..

Read more

i wanna the field of c++ class instance without methods. so i defined two same class respectively in cs and cpp. like: class node{ public: node();… public: node** childs; int id;} AND public class Node{ [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStruct)] public System.IntPtr nodes; [MarshalAs(UnmanagedType.I4)] public int id;} but,the program will fail sometimes and sometimes it will ..

Read more