473,396 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C#.NET COM interoperability: Arrays of UDT's in COM

Raj
Hi,

This is regarding using Arrays of UDT's in COM.

The following is a short description:

- We basically need a structure, struct MAIN_STRUCT which must contain a
dynamic array of another struct, struct SUB_STRUCT. We have a interface
function that is callable by the client, which takes a dynamic array of
MAIN_STRUCT as parameter. So the problem is wrt passing around dynamic
arrays of structs(UDT's) that further contains a dynamic array of another
struct(UDT) in it (from the COM server side).

- We can use SAFEARRAY(struct) but this works only for a simple struct. It
does not appear possible to create SAFEARRAYS(structs) that contain another
struct inside it.

- The other problem is wrt interoperability as we have a (unmanaged)legacy
ATL-COM server whereas a C#.NET client at the other end

Please let me know if you have any suggestions/comments/workarounds for this
problem

Thanks,
Raj
Nov 17 '05 #1
1 2510
Raj,

If you use a safearray for the dynamic array of sub structures, then it
should marshal just fine.

Can you show the definitions of the structures you are using?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Raj" <ra*************@networkgeneral.com> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
Hi,

This is regarding using Arrays of UDT's in COM.

The following is a short description:

- We basically need a structure, struct MAIN_STRUCT which must contain a
dynamic array of another struct, struct SUB_STRUCT. We have a interface
function that is callable by the client, which takes a dynamic array of
MAIN_STRUCT as parameter. So the problem is wrt passing around dynamic
arrays of structs(UDT's) that further contains a dynamic array of another
struct(UDT) in it (from the COM server side).

- We can use SAFEARRAY(struct) but this works only for a simple struct. It
does not appear possible to create SAFEARRAYS(structs) that contain
another struct inside it.

- The other problem is wrt interoperability as we have a (unmanaged)legacy
ATL-COM server whereas a C#.NET client at the other end

Please let me know if you have any suggestions/comments/workarounds for
this problem

Thanks,
Raj

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: T | last post by:
Hi all. I have a problem I have not been able to find a reference about. I am using VB6 and am only a hobbyist programmer. I have 7 arrays of type MyData. Type MyData has 23 elements. Which...
7
by: Mark | last post by:
I built the example application outlined in this artical: http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnservice/html/service02112003.asp There were a number of questions...
0
by: Mike Stoker | last post by:
I'm trying to use an existing COM object from within .NET and am having problems passing a parameter than used to be of type VARIANT. I have a COM interface, IScanner with the following method:...
1
by: John Dann | last post by:
Is it possible in VB.net to have arrays of structures (ie UDTs) where the structure definition includes one or more arrays? Something like: Structure MyUDT ItemOne () as byte 'for example sub...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.