Joshua
02-12-2001, 11:32 PM
in C++ you can do this:
int x = obj.GetAddressOfSomeObject(); // returns int
SomeObject* pSomeObject = (SomeObject*)x;
Let's say that SomeObject is a legacy COM object. So I create a stub using
TLBImp.exe, which will allow me to use the Objects from a managed enviroment.
My problem is that I needed to call the same GetAddressOfSomeObject(), the
address it will return points to an object that was not created on the managed
heap. so I cant do this in C#:
SomeObject someObject = obj.GetAddressOfSomeObject();
Can someone help me? do I need to use MC++ for this? or can use unsafe code?
Thanks.
int x = obj.GetAddressOfSomeObject(); // returns int
SomeObject* pSomeObject = (SomeObject*)x;
Let's say that SomeObject is a legacy COM object. So I create a stub using
TLBImp.exe, which will allow me to use the Objects from a managed enviroment.
My problem is that I needed to call the same GetAddressOfSomeObject(), the
address it will return points to an object that was not created on the managed
heap. so I cant do this in C#:
SomeObject someObject = obj.GetAddressOfSomeObject();
Can someone help me? do I need to use MC++ for this? or can use unsafe code?
Thanks.