-1
我在C++這些聲明:轉換C#和C++與元帥問題
struct objectStruct;
int positionMemory = getPosition();
short size = getSize();
void *allocatedObject; // Originally, it is in C#: IntPtr allocatedObject { get; private set; }
byte[] byteName = Encoding.ASCII.GetBytes("Hello There");
我想從C#這行代碼轉換爲C++:
string result = Marshal.PtrToStringAnsi(new IntPtr(positionMemory), size);
Marshal.StructureToPtr(objectStruct, new IntPtr(positionMemory), true);
Marshal.Copy(byteName, 0, new IntPtr(positionMemory), size);
long posInMemory = allocatedObject.Offset(size).ToInt64();
我不熟悉的封送處理。
什麼問題?你想做什麼? C++聲明與C#代碼有什麼關係(從您展示的內容中不完全清楚)? – Kiril
我需要將一些C#代碼轉換爲C++,並面臨如何從C#轉換爲C++編譯上述對象的問題 – olidev