Solved

question about a variable of type void* in C#

Posted on 2007-04-05
2
594 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now