By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,459 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,459 IT Pros & Developers. It's quick & easy.

Using Pointer to Class/Strcuture in C#

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.