Re: [Ikvm-developers] Using C# attributes from Java
Brought to you by:
jfrijters
|
From: Jeroen F. <je...@su...> - 2013-04-29 16:53:36
|
Hi Michael,
I looked into this, but I can't find anything wrong. I can't reproduce what you are seeing, but monodis is not a very good disassembler (and is probably going to be replaced by ikdasm). The .ctor quoting has no meaning, in the binary there is no such concept as quoting identifiers. I don't know why monodis emit a spurious class keyword (it is not needed in this context), but in my tests it always does so (both for ikvmc generated binaries and csc generated ones).
So, in short, I don't think this is a problem.
Regards,
Jeroen
> -----Original Message-----
> From: Michael Bayne [mailto:md...@sa...]
> Sent: Saturday, April 27, 2013 1:44
> To: ikv...@li...
> Subject: [Ikvm-developers] Using C# attributes from Java
>
> I'm trying to use a C# attribute on a Java class (which is used by
> MonoTouch for some under the hood magic which AFAIK is based on C#
> reflection, so it shouldn't be too crazy).
>
> If I write my class in C# like so:
>
> [Register ("AppDelegate")]
> public partial class AppDelegate : UIApplicationDelegate {
>
> (where Register is MonoTouch.Foundation.Register). Then I get a
> disassembly (from monodis) that looks like this:
>
> .custom instance void class
> [monotouch]MonoTouch.Foundation.RegisterAttribute::'.ctor'(string) = (
> 01 00 0B 41 70 70 44 65 6C 65 67 61 74 65 00 00 ) //
> ...AppDelegate..
>
> If I write my class in Java like so:
>
> @RegisterAttribute.Annotation("AppDelegate")
> public class AppDelegate extends UIApplicationDelegate {
>
> and then convert it to a DLL via IKVM, I get a disassembly that looks
> like this:
>
> .custom instance void
> [monotouch]MonoTouch.Foundation.RegisterAttribute::.ctor(string) = (
> 01 00 0B 41 70 70 44 65 6C 65 67 61 74 65 00 00 ) //
> ...AppDelegate..
>
> I'll admit to not knowing the first thing about how C# attributes work,
> but the two things that jump out are, from C# I get "instance void class
> ...RegisterAttribute" and from Java/IKVM I get only "instance void
> ...RegisterAttribute", which seems like it could be causing problems.
> There's also the issue that from C# the '.ctor' method is quoted and
> from Java/IKVM it's not.
>
> I should also point out that this is using IKVM 0.46.0.1, which I know
> is woefully out of date, so if this is a known issue that has been fixed
> long since, feel free to tell me to shut the hell up and update my
> MonoTouch-compatible IKVM fork.
>
> Thanks!
>
> Michael
>
> -- md...@sa... <mailto:md...@sa...>
|