471,321 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

how to convert a delegate to int

DR
I created a new delegate object and I want to pass it to a function which
takes int.
How to convert to int?
Feb 20 '06 #1
4 1832
I created a new delegate object and I want to pass it to a function which
takes int.


Why is the parameter type an int? Is this a call to a native DLL where
the int represents a function pointer?
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Feb 20 '06 #2

"DR" <dr****@yahoo.com> wrote in message
news:ea**************@TK2MSFTNGP11.phx.gbl...
|I created a new delegate object and I want to pass it to a function which
| takes int.
| How to convert to int?
|
|

You should not convert it to an int, an int is not platform independent,
declare your function to take a delegate, or, when using V2 of the framework
an IntPtr returned from the call to
Marshal.GetFunctionPointerForDelegate(myDelegate).

Willy.

Feb 20 '06 #3
Hello, DR!

D> I created a new delegate object and I want to pass it to a function
D> which takes int.
D> How to convert to int?

For what purpose you want do this?
If you mean passing delegates as callback to the unmanaged code, then
( http://msdn.microsoft.com/library/en...backSample.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Feb 20 '06 #4
DR
I have a COM object which takes a function pointer as int (or long).
Hello, DR!

D> I created a new delegate object and I want to pass it to a function
D> which takes int.
D> How to convert to int?

For what purpose you want do this?
If you mean passing delegates as callback to the unmanaged code, then
(
http://msdn.microsoft.com/library/en...backSample.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

Feb 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by juli | last post: by
5 posts views Thread by Supra | last post: by
6 posts views Thread by =?ISO-8859-1?Q?Norbert_P=FCrringer?= | last post: by
reply views Thread by rosydwin | last post: by

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.