Solved

question about a variable of type void* in C#

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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.

747 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

10 Experts available now in Live!

Get 1:1 Help Now