Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.


Go Back   Vista Forums > Misc Newsgroups > .NET General

RB

Vista - COM Interop and Pointer to Array

Reply
 
10-28-2008   #1
Mike


 
 

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

My System SpecsSystem Spec
10-29-2008   #2
PvdG42


 
 

Re: COM Interop and Pointer to Array

"Mike" <MLM450@xxxxxx> wrote in message
news:f71ac631-5d1c-449e-8db5-7154e5c5c4e9@xxxxxx
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)?

My System SpecsSystem Spec
Reply

RB


Thread Tools


Similar Threads for: COM Interop and Pointer to Array
Thread Forum
Fast copy method of sub array (=array range) possible? VB Script
COM Interop and Array Pointers .NET General
Stupid Array Tricks: Initializing an Array to a Certain Size PowerShell
Microsoft.VirtualServer.Interop.dll and the Microsoft.VMRCClientControl.Interop.dll Virtual Server
Using an interop assembly with interop dependencies PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd