Re: [Mono-dev] MonoMethod-MethodInfo
That is totally acceptable. Anyone with an idea where the Module identifier sits on monoclass? On Sun, Feb 15, 2015 at 10:52 AM, Konrad Kruczynski kkruczyn...@antmicro.com wrote: Note however, that resolution via metadata token can only give you an open type, that is information about bound generic type is lost during MethodInfo - MetadataToken - MethodInfo (since, naturally, only open types are present in the assembly). -- BR, Konrad 2015-02-15 9:15 GMT+01:00 Greg Young gregoryyou...@gmail.com: Now to get module on the unmanaged side. I figured it might be in MonoClass but have yet to find it there. Maybe I should be looking under the referenced MonoImage (though that doesn't seem quite right) On Sun, Feb 15, 2015 at 9:00 AM, Jeroen Frijters jer...@sumatra.nl wrote: If you know the module on the managed side, Module.ResolveMethod() can be used to get a MethodInfo from a token. Regards, Jeroen -Original Message- From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- boun...@lists.ximian.com] On Behalf Of Greg Young Sent: Saturday, February 14, 2015 21:56 To: mono-devel-list@lists.ximian.com Subject: [Mono-dev] MonoMethod-MethodInfo Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] MonoMethod-MethodInfo
Note however, that resolution via metadata token can only give you an open type, that is information about bound generic type is lost during MethodInfo - MetadataToken - MethodInfo (since, naturally, only open types are present in the assembly). -- BR, Konrad 2015-02-15 9:15 GMT+01:00 Greg Young gregoryyou...@gmail.com: Now to get module on the unmanaged side. I figured it might be in MonoClass but have yet to find it there. Maybe I should be looking under the referenced MonoImage (though that doesn't seem quite right) On Sun, Feb 15, 2015 at 9:00 AM, Jeroen Frijters jer...@sumatra.nl wrote: If you know the module on the managed side, Module.ResolveMethod() can be used to get a MethodInfo from a token. Regards, Jeroen -Original Message- From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- boun...@lists.ximian.com] On Behalf Of Greg Young Sent: Saturday, February 14, 2015 21:56 To: mono-devel-list@lists.ximian.com Subject: [Mono-dev] MonoMethod-MethodInfo Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] MonoMethod-MethodInfo
Now to get module on the unmanaged side. I figured it might be in MonoClass but have yet to find it there. Maybe I should be looking under the referenced MonoImage (though that doesn't seem quite right) On Sun, Feb 15, 2015 at 9:00 AM, Jeroen Frijters jer...@sumatra.nl wrote: If you know the module on the managed side, Module.ResolveMethod() can be used to get a MethodInfo from a token. Regards, Jeroen -Original Message- From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- boun...@lists.ximian.com] On Behalf Of Greg Young Sent: Saturday, February 14, 2015 21:56 To: mono-devel-list@lists.ximian.com Subject: [Mono-dev] MonoMethod-MethodInfo Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] MonoMethod-MethodInfo
If you know the module on the managed side, Module.ResolveMethod() can be used to get a MethodInfo from a token. Regards, Jeroen -Original Message- From: mono-devel-list-boun...@lists.ximian.com [mailto:mono-devel-list- boun...@lists.ximian.com] On Behalf Of Greg Young Sent: Saturday, February 14, 2015 21:56 To: mono-devel-list@lists.ximian.com Subject: [Mono-dev] MonoMethod-MethodInfo Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] MonoMethod-MethodInfo
You could pass the manged MethodInfo* object directly into managed, retrieving it in native code by calling: mono_method_get_object Alternatively, you could pass a System.RuntimeMethodHandle struct into managed code (with the MonoMethod* as the value in that structure) and call MethodBase.GetMethodFromHandle to retrieve the method from that handle when needed. - Jonathan On Sat, Feb 14, 2015 at 3:56 PM, Greg Young gregoryyou...@gmail.com wrote: Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list
Re: [Mono-dev] MonoMethod-MethodInfo
I have to pass by lookup values. My unmanaged is running in the context of a profiler. On Saturday, February 14, 2015, Jonathan Chambers jonc...@gmail.com wrote: You could pass the manged MethodInfo* object directly into managed, retrieving it in native code by calling: mono_method_get_object Alternatively, you could pass a System.RuntimeMethodHandle struct into managed code (with the MonoMethod* as the value in that structure) and call MethodBase.GetMethodFromHandle to retrieve the method from that handle when needed. - Jonathan On Sat, Feb 14, 2015 at 3:56 PM, Greg Young gregoryyou...@gmail.com javascript:_e(%7B%7D,'cvml','gregoryyou...@gmail.com'); wrote: Let's say I have a MonoMethod in unmanaged code. I want to pass some data out of that code back into managed code (using some identifiers of the monomethod) so that the managed code can obtain a MethodInfo via reflection. At first I thought about passing the token(s). I cannot however find anyway of looking up a MethodInfo based on its token (nor a type ...). I could get the type and then iterate over the methods but this seems like a bad idea. 1) Am I missing something with tokens on the managed side? 2) Is there some other way of doing this that I am missing? Cheers, Greg -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com javascript:_e(%7B%7D,'cvml','Mono-devel-list@lists.ximian.com'); http://lists.ximian.com/mailman/listinfo/mono-devel-list -- Studying for the Turing test ___ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list