.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 8th, 2003, 06:24 AM
007Dev 007Dev is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 5 007Dev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
array pointer passed to function in C#

I have a device with an ActiveX control as well as some C++ dll functions only. I would like to develop my application in C# but am finding some syntactical problems with the provided methods of the ActiveX control.

In order to use the data acquired by the device a pre-initialised buffer or array pointer must be passed to a method of the ActiveX upon completion the array should contain the data and also return an indication of how much data was returned, as shown below (from documentation)

object.CopyTemplate lpBuff

Part Description
object The control
lpBuff Pointer to the buffer or array in which to copy the
data template.

The problem I have is in declaring the buffer. This is what I have tried to no avail.

byte[] data = new byte[object.datasize]; //(datasize provided by object after acquisition - array initiliased)

fixed (byte * Ptr_Data = Data) //obtaining pointer to array
Object.CopyTemplate (Ptr_Data);

This should do it as far as Im concerned since I am passing it a pointer to the start of the array... but i get an error stating that it cannot convert int* to int when declared like this. It works when I have it declared like below

Object.CopyTemplate(*Ptr_Data);

This way however does not read any results into the provided pointer. What am I missing? It must be a syntax error.
Looking at the tooltip provided for the method it states "CopyTemplate (int)" but why does the doc say "pointer to buffer" - which is it?

Any help appreciated.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > array pointer passed to function in C#

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap