G
Guest
All
I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that I'm not sure are specific anomolies that I'm having, or if they are specific known issues I'm facing.
1. In VB.NET, are arrays stored on the stack or the heap? Why must arrays of value types be boxed
in order for them to be (effectively) passed by reference
2. In VB.NET, if objects are 'always' passed by reference, then what precisely is the difference between passing an object by value or by reference
3. I've noticed that there are many COM DLLs that just appear to be 'wrappers' to plain DLLs. If the functionality I really want is really in the DLL, am I better off using P/Invoke on the DLL, or am I better off using the ActiveX component? Can I, in the same code, mix the P/Invoke and COM calls (again in, VB.NET)
4. I have a COM component that accepts a pointer to a structure. The *only* way I can get it to work, however, is if I box an array of the same size as the structure, and pass that into the COM function. If I declare my own parallel structure (sometimes using StructLayout), I get an "Invalid memory" or "Null Reference" exception. Does this behaviour sound correct? What reason might there be for this behaviour
I have another COM component that takes a pointer to a structure, but the COM component itself does the memory allocation. How can I get this structure (ideally a shallow copy, but I'll settle for a deep copy --- I just want the data) back into .NET?
I have some general .NET questions that I'm looking for some help with. Some of these questions (like the first) are ones that I've seen various conflicting information on, or questions that I'm not sure are specific anomolies that I'm having, or if they are specific known issues I'm facing.
1. In VB.NET, are arrays stored on the stack or the heap? Why must arrays of value types be boxed
in order for them to be (effectively) passed by reference
2. In VB.NET, if objects are 'always' passed by reference, then what precisely is the difference between passing an object by value or by reference
3. I've noticed that there are many COM DLLs that just appear to be 'wrappers' to plain DLLs. If the functionality I really want is really in the DLL, am I better off using P/Invoke on the DLL, or am I better off using the ActiveX component? Can I, in the same code, mix the P/Invoke and COM calls (again in, VB.NET)
4. I have a COM component that accepts a pointer to a structure. The *only* way I can get it to work, however, is if I box an array of the same size as the structure, and pass that into the COM function. If I declare my own parallel structure (sometimes using StructLayout), I get an "Invalid memory" or "Null Reference" exception. Does this behaviour sound correct? What reason might there be for this behaviour
I have another COM component that takes a pointer to a structure, but the COM component itself does the memory allocation. How can I get this structure (ideally a shallow copy, but I'll settle for a deep copy --- I just want the data) back into .NET?