We're having a programming problem. Anybody know how you can have a pointer to an array that has a pointer in it? Siegel
This is it in C+: SBYTE_ARRAY InputMsg; SBYTE_ARRAY OutputMsg; unsigned long status; unsigned char EcuAddr[1]; // ECU target address array unsigned char KeyWord[2]; // Keyword identifier array EcuAddr[0] = 0x33; // Initialization address used to activate all ECUs InputMsg.NumOfBytes = 1; // ECU target address array contains one address. InputMsg.BytePtr = &EcuAddr[0]; // Assign pointer to ECU target address array. OutputMsg.NumOfBytes = 2; // KeyWord array has 2 bytes allocated. OutputMsg.BytePtr = &KeyWord[0]; // Assign pointer to KeyWord array. status = PassThruIoctl(ChannelID, FIVE_BAUD_INIT, &InputMsg, &OutputMsg);
Well, we need that code translated into C# specifically, the line OutputMsg.BytePtr = &KeyWord[0]; // Assign pointer to KeyWord array. I think I have the rest of it figured out except for, I don't want the memory manager messing with the variables before I pass the pointers to the following function call, so I think a fixed statement needs to work its way in somewhere, but it is unclear how to have a fixed statement cover a block of code. Brian
HMM you dont want the GC messing with the vars right? You could put that in a Unsafe block and tell the GC not the manage those vars..
http://www.c-sharpcorner.com/Upload...feCode11102005040251AM/WritingUnsafeCode.aspx That will tell you how to FIX the GC not to move shit around.
What software are you using Scott? IbOpenSource You can have pointers pointing to pointers that point to other pointers....yeah messy especially when the GC starts doing things. Too bad it's not in Java....I'd crack it in a heartbeat.