Creating a native NuGet package for iOS with static .a libs, using DllImport for binding

William.4025William.4025 ✭✭USMember ✭✭

Hi Everyone,

Bindings using DllImport[...]
Right now i have a lib folder in the iOS app and in the mtouch i am linking these .a files manually. //-cxx -gcc_flags "-L${ProjectDir} -lmylib1 -lmylib2 -forceload .."

All good, libs are called, all working.

BUT i want to create a nuGet package that contains all the required files AND when you just add it to the ios project it will link it to the final binaries without any mtouch argument. We dont want to expose the lib files directly.

I created a Bindings project, added all the native .a files, set ForceLoading, SmartLinking, C++ checkboxes on all the libs, added it as a reference to the iOS.

Does not work!

Tried to add linking flags as well to the native references invidually like: -gcc_flags "-L${ProjectDir} -lmylib1", every native links itself, didn't help.
Libs are only copied into the ios app, but not linked with the binary.

Xamarin shows errors at building: Native linking failed: undefined symbol ... MTOUCH MT 5202

Can i make it work somehow with nuget packages?

Thanks guys

Best Answer

  • William.4025William.4025 ✭✭ US ✭✭
    Accepted Answer

    Solved the problem. Works with normal ios bindings project. i had some issues with the built static libs.

Answers

Sign In or Register to comment.