Binding project requires *.dylib

I've created a binding project to a 3rd party library. The framework communicates with an external device (to do barcode scanning etc). Their sdk documentation states that in order to use the library to communicate with the device further frameworks and libraries need to be imported, namely ExternalAccessory.framework and libz.1.2.5.dylib. Adding external accessory was a case of modifying the assembly.linkwith.cs file. But how about adding a dylib?

I found some documentation here, https://developer.xamarin.com/guides/ios/advanced_topics/native_interop/#Accessing_C_Dylibs , but it's not what i really need as I don't need to call anything in the dylib directly in my code.

Best Answer

  • bryan1bryan1 IEMember ✭✭
    Accepted Answer

    Thanks to @NashZhou on the xamarin slack channel i just need a flag -lz.1.2.5 . So my full linkWith was:

    [assembly: LinkWith ("YourFramework.a",
    LinkTarget.ArmV7 | LinkTarget.ArmV7s| LinkTarget.Arm64| LinkTarget.Simulator| LinkTarget.Simulator64,
    Frameworks = "ExternalAccessory CFNetwork ...Some other frameworks..",
    LinkerFlags = "-lz.1.2.5",
    ForceLoad = true, SmartLink = true)]

Answers

  • bryan1bryan1 IEMember ✭✭
    Accepted Answer

    Thanks to @NashZhou on the xamarin slack channel i just need a flag -lz.1.2.5 . So my full linkWith was:

    [assembly: LinkWith ("YourFramework.a",
    LinkTarget.ArmV7 | LinkTarget.ArmV7s| LinkTarget.Arm64| LinkTarget.Simulator| LinkTarget.Simulator64,
    Frameworks = "ExternalAccessory CFNetwork ...Some other frameworks..",
    LinkerFlags = "-lz.1.2.5",
    ForceLoad = true, SmartLink = true)]

Sign In or Register to comment.