PC Review


Reply
Thread Tools Rate Thread

COM Interop and Pointer to Array

 
 
Mike
Guest
Posts: n/a
 
      28th Oct 2008
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
 
Reply With Quote
 
 
 
 
PvdG42
Guest
Posts: n/a
 
      29th Oct 2008
"Mike" <(E-Mail Removed)> wrote in message
news:f71ac631-5d1c-449e-8db5-(E-Mail Removed)...
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)?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
COM interop - pointer parameter Goran Microsoft C# .NET 0 2nd Jul 2009 03:29 PM
COM Interop and Pointer to Array Mike Microsoft Dot NET 1 29th Oct 2008 12:57 PM
[Q] Interop: Pointer to structure in interface method yadolov@gmail.com Microsoft C# .NET 1 15th Aug 2007 04:24 PM
Interop, Create a pointer to a string array? Rob Mayo Microsoft Dot NET 0 24th Aug 2005 02:28 PM
For C# Interop, how to deal with pointer field in struct in IDL? lawrence Microsoft C# .NET 0 10th Jun 2004 04:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:22 PM.