473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using Pointer to Class/Strcuture in C#

Hi all,i am a newbie in C#. I need to use pointer to a class and strcuture that i have defined in C# so that i call pass their memory address to some function called from Win32 dll (Platform Invoke)?

How can i do that? Thanks very much
Nov 15 '05 #1
2 6687
You usually don't use a pointer. Usually it is a matter of defining the
struct correctly, and the defining the p/invode declaration correctly.

Please tell us what what function and the structure so someone can help you
with this
Regards
Brian W


"juvchan" <an*******@discussions.microsoft.com> wrote in message
news:B4**********************************@microsof t.com...
Hi all,i am a newbie in C#. I need to use pointer to a class and strcuture that i have defined in C# so that i call pass their memory address to some
function called from Win32 dll (Platform Invoke)?
How can i do that? Thanks very much

Nov 15 '05 #2
Hi juvchan,

Pointers can be used inside unsafe block with 'Allow unsafe Code
Blocks' to true. Here is the example:

int Num1=10;
unsafe
{
int * ptr =&Num1;
* ptr =20;
Console.WriteLine(Num1);
}

Regards,

Rohit
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stephane Routelous | last post by:
Hi, I would like to make a forward declaration of a strcuture nested in a class. I have file A.h class A { public: struct B
1
by: virajajgaonkar | last post by:
Hello All, My aim is to have a MFC application which takes two word file names as input. Then it opens these two word files in ms word apllication windows for comparing side by side with...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
6
by: ivan.leben | last post by:
I want to write a Mesh class using half-edges. This class uses three other classes: Vertex, HalfEdge and Face. These classes should be linked properly in the process of building up the mesh by...
6
by: semkaa | last post by:
Can you explain why using ref keyword for passing parameters works slower that passing parameters by values itself. I wrote 2 examples to test it: //using ref static void Main(string args) {...
29
by: shuisheng | last post by:
Dear All, The problem of choosing pointer or reference is always confusing me. Would you please give me some suggestion on it. I appreciate your kind help. For example, I'd like to convert a...
10
by: Angel Tsankov | last post by:
Hello! Is the following code illformed or does it yield undefined behaviour: class a {}; class b {
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
0
by: krishnasamy | last post by:
Hello, I am writing a DLL for Capturing the Image from Camera Device using Camera SDK DLL. All the calls made to functions in Camera SDK DLL are working properly as I am able to get a return...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.