473,396 Members | 1,846 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.

COM Interop and Pointer to Array

A function in a COM DLL I use takes a pointer to the first element in
an array of short integers.

Foo(short* array)

COM interop provides this function to me in the .NET world by making
the parameter “ref short”.

Foo(ref short array)

It seems like no matter what I try, the COM DLL only sees the first
element in the array. Is there a way to get it to see the entire array
of values? Maybe some sort of marshalling I haven’t tried yet?

Thanks,
Mike
Oct 28 '08 #1
1 2693
"Mike" <ML****@hotmail.comwrote in message
news:f7**********************************@u57g2000 hsf.googlegroups.com...
A function in a COM DLL I use takes a pointer to the first element in
an array of short integers.

Foo(short* array)

COM interop provides this function to me in the .NET world by making
the parameter “ref short”.

Foo(ref short array)

It seems like no matter what I try, the COM DLL only sees the first
element in the array. Is there a way to get it to see the entire array
of values? Maybe some sort of marshalling I haven’t tried yet?

Thanks,
Mike
Assuming you are using C#, what happens happens if you change the parameter
type to Foo(ref short[] array)?

Oct 29 '08 #2

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

Similar topics

1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
3
by: Stefan Slapeta | last post by:
Hi all, I've no idea how to write the C# signatures for these four kinds of parameters of C++ (better: C) functions exported from a DLL: // i is ONLY out void f1(unsigned int *i); // ai...
3
by: cees | last post by:
Hi, I need to call an external C-function that accept an array of void pointers (void **). Each item can either be a single float,int,char or a C-array of these types. Is that possible and if so...
6
by: Nataraj1978 | last post by:
I have a requirement to use a dll written in Visual C++ 6.0 in my C# application. In order to establish the link between my application and the dll, I have written a ATL COM Component in Visual...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
2
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
1
by: Don.Leri | last post by:
Hi, I have a logger.dll (unmanaged c++ dll compiled in vs2005). I have a C# interop to use that dll in managed code implemented in Interfaces.dll (used by other C# dlls). I also have a...
5
by: John | last post by:
I would like to ask a question that is obvious to all people porting applications from the "traditional" C\VB6 interop scheme choosing C# vs VB.NET. We have a math library in C which...
1
by: Mike | last post by:
A function in a COM DLL I use takes a pointer to the first element in an array of short integers. Foo(short* array) COM interop provides this function to me in the .NET world by making the...
0
by: Mike | last post by:
I am using a COM DLL function that takes a pointer to the first element in an array of short values. Foo(short* array) COM interop provides that function to me in the .NET world with a "ref...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.