473,668 Members | 2,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#.NET COM interoperabilit y: 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(struc t) but this works only for a simple struct. It
does not appear possible to create SAFEARRAYS(stru cts) that contain another
struct inside it.

- The other problem is wrt interoperabilit y as we have a (unmanaged)lega cy
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 2521
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.co m

"Raj" <ra************ *@networkgenera l.com> wrote in message
news:e6******** ******@TK2MSFTN GP12.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(struc t) but this works only for a simple struct. It
does not appear possible to create SAFEARRAYS(stru cts) that contain
another struct inside it.

- The other problem is wrt interoperabilit y as we have a (unmanaged)lega cy
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
6814
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 array that is operated on depends on 1 of 7 options Currently if I want to write to an array I have to do this: if opt1 then array1(x).data1= 36 array1(x).data2= 23 ..
7
3340
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 along the same lines posted to the page's discussion forum but no one replied with a solution. The problem I am experiencing is with the 3rd example.
0
1262
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: virtual HRESULT __stdcall GetOptionDetails ( /**/ long lOption, /**/ VARIANT * pVarBuffer,
1
1402
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 new(byval dimension as integer) redim itemone(dimension) end sub End structure
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8889
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8572
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.