Solved

question about a variable of type void* in C#

Posted on 2007-04-05
2
611 Views
Last Modified: 2008-02-01
I'm using some unsafe code in a C# project of mine because it needs to be able to communicate with a C++ DLL.  One of the variables that's going between each language is a pointer of type "void* ".  Its actually a buffer containing pixel values of an image.  I'm just wondering how to access the values in C#.  buffer[x] isn't a valid way to get the xth pixel.

anybody know where i can find information on what i can do to a "void *" in C#?
0
Comment
Question by:raw_enha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
dave4dl earned 500 total points
ID: 18861293
Read this on pointer conversions to c# :

http://en.csharp-online.net/ECMA-334:_27.4_Pointer_conversions

i.e. use byte*
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 18862484
.NET representation of void* is IntPtr. C# code can read native memory using unsafe programming or Marshal.Copy, Marshal.Read methods.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question