Solved

question about a variable of type void* in C#

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

830 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