locked
Difference between bmac.exe on Xamarin and MonoMac when compiling MASShortcutSharp RRS feed

  • Question

  • User2107 posted

    Hi, I'm new to monomac development, but loving it so far.

    I'm trying to use native bindings to the MASShortcutSharp library. They work fine for Monomac, and I can compile them without errors:

     $ mono bmac.exe MASShortcut/masshortcut.cs -s=MASShortcut/Extras.cs -d=MONOMAC -r:System.Drawing.dll --outdir=monomac
    

    When I try to switch to the Xamarin bmac (as per many Makefiles), I start getting errors:

     $ /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/usr/bin/bmac MASShortcut/masshortcut.cs -s=MASShortcut/Extras.cs -d=MONOMAC -r:System.Drawing.dll --outdir=monomac
      error BI1018: bmac: No [Export] attribute on property Shortcut.MASShortcut.KeyCode
    

    and including the Xamarin.dll leads to different errors:

     $ /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/usr/bin/bmac MASShortcut/masshortcut.cs -s=MASShortcut/Extras.cs -d=MONOMAC -r:System.Drawing.dll --outdir=monomac -baselib=/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/usr/lib/mono/XamMac.dll
     monomac/Shortcut/MASShortcut.g.cs(330,18): error CS0246: The type or namespace name `MonoPInvokeCallback' could not be found. Are you missing a using directive or an assembly reference?
     monomac/Shortcut/MASShortcut.g.cs(330,18): error CS0246: The type or namespace name `MonoPInvokeCallbackAttribute' could not be found. Are you missing a using directive or an assembly reference?
    

    I hope I'm missing something obvious. Is there an error in how I'm trying to compile the library?

    Thanks for any help!

    Thursday, February 7, 2013 2:35 AM

All replies

  • User39 posted

    There's a bug in the Xamarin.Mac's bmac preventing MASShortcutSharp from compiling.

    You can fix it by adding the following at the very top of the Extras.cs file:

    using System;
    
    [AttributeUsage (AttributeTargets.Method)]
    public sealed class MonoPInvokeCallbackAttribute : Attribute {
        public MonoPInvokeCallbackAttribute (Type t) {}
    }
    

    The bug has already been fixed, and this workaround should not be necessary in the next Xamarin.Mac release.

    Thursday, February 7, 2013 12:32 PM
  • User2107 posted

    Thanks, it worked!

    Thursday, February 7, 2013 11:56 PM