Paste dylib into Xamarin.Mac binding dll

I am creating bindings for Xamarin.Mac / MonoMac . I would like to embed dylib in the generated dll , as I did on Xamarin.iOS with the [LinkWith] attribute.

Can this be done? if so, how? Or should I download dylib from a consumer application? again in this case, how?

I tried: - removing dylib in the Native References folder (doesn't work) - adding the [assembly: MonoMac.RequiredFramework] attribute (doesn't find dylib )

+8
dylib monomac
source share
1 answer

I was able to download .dylib from a consumer application by doing the following:

  • Add .dylib to your project as Content
  • add RequiredFrameworkAttribute :
  [assembly: MonoMac.RequiredFramework("mylib.dylib")] 
  • register the assembly from the AppDelegate constructor:
  public partial class AppDelegate : NSApplicationDelegate { public AppDelegate () { Type t = typeof(ATypeFromTheAssembly); MonoMac.ObjCRuntime.Runtime.RegisterAssembly (t.Assembly); } } 

This still doesn't embed .dylib in the binding assembly, but it is consistent with progress

+5
source share

All Articles