G
Guest
Hi,
I am making a wrapper class so I can call unmanaged classes from C#, I
have these structs that I want to pass and get back from the unmanaged
classes, do I...
1) Create a copy of these structs for the managed world like
public __value struct SomeStruct
{
System::UInt32 SomeVal;
System::UInt32 SomeVal2;
System::UInt32 SomeVal3;
}
and use these from C# and then pass this to the method wrapper, that is
calling the unmanaged method like...
someReferenceToObject->someMethod(..., SomeStruct);
or 2)
do I make it like so..
public __gc class SomeThing
{
private: SOMEUNMANAGEDTHING* someUnmanagedThing;
public: SomeThing()
{
someUnamangedThing = new SOMEUNMANAGEDTHING();
}
public: ~SomeThing()
{
delete someUnmanagedThing;
}
// private so only the genereated prop is visible
private: __property System::UInt32 get_SomeVal()
{
return someUnmanagedThing->SomeVal;
}
// private so only the genereated prop is visible
private: __property void get_SomeVal(System::UInt32 value)
{
someUnmanagedThing->SomeVal = value;
}
}
and passt his to the unmanaged method like previously?
Whats the best way to make unmanaged structs visible to the managed world?
Thanks
I am making a wrapper class so I can call unmanaged classes from C#, I
have these structs that I want to pass and get back from the unmanaged
classes, do I...
1) Create a copy of these structs for the managed world like
public __value struct SomeStruct
{
System::UInt32 SomeVal;
System::UInt32 SomeVal2;
System::UInt32 SomeVal3;
}
and use these from C# and then pass this to the method wrapper, that is
calling the unmanaged method like...
someReferenceToObject->someMethod(..., SomeStruct);
or 2)
do I make it like so..
public __gc class SomeThing
{
private: SOMEUNMANAGEDTHING* someUnmanagedThing;
public: SomeThing()
{
someUnamangedThing = new SOMEUNMANAGEDTHING();
}
public: ~SomeThing()
{
delete someUnmanagedThing;
}
// private so only the genereated prop is visible
private: __property System::UInt32 get_SomeVal()
{
return someUnmanagedThing->SomeVal;
}
// private so only the genereated prop is visible
private: __property void get_SomeVal(System::UInt32 value)
{
someUnmanagedThing->SomeVal = value;
}
}
and passt his to the unmanaged method like previously?
Whats the best way to make unmanaged structs visible to the managed world?
Thanks