A
azerty
Hello !
In previous message (see below), Dominic Cooney try to create a delagate by
reflexion
but MethodInfo.GetFunctionPointer doesn't exist on CF
I try another technique (work fine on PC platform)
I create a temporary Delegate on my function and use reflection to load
value in private member "_methodPtr"
The code is :
Delegate tmpDelegate = new EventHandler(Form1_EventTest);
FieldInfo fi = typeof(Delegate).GetField("_methodPtr",
BindingFlags.NonPublic |
BindingFlags.Instance);
Int32 ptrMethod = (Int32)fi.GetValue(tmpDelegate);
Delegate newDelegate = (Delegate)MyConstructorInfo.Invoke(new object[]
{this , ptrMethod } );
it work fine on PC but throw an exception on PPC (InvalidProgramException)
Do you know why ?
Another question : is it possible to include MSIL instruction in C# program
(like ASM instruction in C/C++ or Delphi program) ???
thanks for your help !
De :Tim Gerken [MSFT] ([email protected])
Objet :RE: Getting function pointer/creating delegate with Reflection
View this article only
Groupes de discussion :microsoft.public.dotnet.framework.compactframework
Date :2003-03-05 15:24:03 PST
Sorry, Dominic, there is no way to get at this information on the .NET
Compact Framework.
Tim
This posting is provide "AS IS" with no warranties, and confers no rights.
--------------------
| From: (e-mail address removed) (Dominic Cooney)
| Subject: Getting function pointer/creating delegate with Reflection
| Date: 5 Feb 2003 16:48:40 -0800
|
| Is there any way to get the same pointer that ldftn returns, without
| using ldftn (i.e. via a MethodInfo or RuntimeMethodHandle)?
|
| My situation is this: Given a MethodInfo I want to create a delegate
| via Reflection. Delegate constructors require a function pointer,
| usually retrieved by ldftn. On .NET, you can retrieve a method pointer
| via Reflection using methodInfo.MethodHandle.GetFunctionPointer(),
| however that is not supported on .NET CF.
|
| I'm not concerned about future portability. I'd be happy to know a
| hack to get the pointer.
In previous message (see below), Dominic Cooney try to create a delagate by
reflexion
but MethodInfo.GetFunctionPointer doesn't exist on CF
I try another technique (work fine on PC platform)
I create a temporary Delegate on my function and use reflection to load
value in private member "_methodPtr"
The code is :
Delegate tmpDelegate = new EventHandler(Form1_EventTest);
FieldInfo fi = typeof(Delegate).GetField("_methodPtr",
BindingFlags.NonPublic |
BindingFlags.Instance);
Int32 ptrMethod = (Int32)fi.GetValue(tmpDelegate);
Delegate newDelegate = (Delegate)MyConstructorInfo.Invoke(new object[]
{this , ptrMethod } );
it work fine on PC but throw an exception on PPC (InvalidProgramException)
Do you know why ?
Another question : is it possible to include MSIL instruction in C# program
(like ASM instruction in C/C++ or Delphi program) ???
thanks for your help !
De :Tim Gerken [MSFT] ([email protected])
Objet :RE: Getting function pointer/creating delegate with Reflection
View this article only
Groupes de discussion :microsoft.public.dotnet.framework.compactframework
Date :2003-03-05 15:24:03 PST
Sorry, Dominic, there is no way to get at this information on the .NET
Compact Framework.
Tim
This posting is provide "AS IS" with no warranties, and confers no rights.
--------------------
| From: (e-mail address removed) (Dominic Cooney)
| Subject: Getting function pointer/creating delegate with Reflection
| Date: 5 Feb 2003 16:48:40 -0800
|
| Is there any way to get the same pointer that ldftn returns, without
| using ldftn (i.e. via a MethodInfo or RuntimeMethodHandle)?
|
| My situation is this: Given a MethodInfo I want to create a delegate
| via Reflection. Delegate constructors require a function pointer,
| usually retrieved by ldftn. On .NET, you can retrieve a method pointer
| via Reflection using methodInfo.MethodHandle.GetFunctionPointer(),
| however that is not supported on .NET CF.
|
| I'm not concerned about future portability. I'd be happy to know a
| hack to get the pointer.