Notifications
Clear all
Sep 07, 2021 10:52 pm
“&” in &pckt means we should send the pointer not variable, right?
yes in you are passing the memory address of the object… you could also do it like this
SetXFormPacket* pckt = new SetXFormPacket(destTM);
tmControl->SetValue(ip->GetTime(), pckt);
delete pckt;
Sep 07, 2021 10:52 pm
what about…
object setXFormPacket = globalInterface.SetXFormPacket.Create(matrix,globalInterface.Matrix3.Create());
object* ptr = &setXFormPacket ;
node.TMController.SetValue(coreInterface.Time, ptr, true, GetSetMethod.Absolute);
Sep 07, 2021 10:52 pm
I got several errors for this:
Compiler Error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
Compiler Error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('object')
Sep 07, 2021 10:52 pm
could try something like…
unsafe
{
object setXFormPacket = globalInterface.SetXFormPacket.Create(matrix,globalInterface.Matrix3.Create());
void* ptr = &setXFormPacket ;
node.TMController.SetValue(coreInterface.Time, ptr, true, GetSetMethod.Absolute);
}
Sep 07, 2021 10:52 pm
Not working…
|Error|CS0208|Cannot take the address of, get the size of, or declare a pointer to a managed type
|Error|CS1503|Argument 2: cannot convert from 'void*' to 'object
which dotnet version do you use? mine is 4.7.2 and “Allow unsafe code” option is enabled.
Sep 07, 2021 10:52 pm
I’m not using dotnet , just making guesses as I know nothing about c# and max. The only I can think of trying is to create your own c# callable c++ function wrapper to handle it.