Forum Xamarin.iOS

Static Library Missing From Test App

I have creating a binding for a third party static library. This compiles fine and the resulting DLL is 63MB.
If I decompile this with IKDASM I see the .a file as a resource.

When I try to use the binding in a test app however, the DLL shrinks to 396kb in the app package.
If I decompile this DLL the resource entry is missing.

The result is I get the "unrecognized selector sent to instance" error as soon as I try to use any methods in the binding library.

This happens in the simulator as well which is set to Don't Link.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    If you call Objective-C categories , you need to add "-ObjC" flag in LinkWith .

    [assembly: LinkWith ("...", LinkerFlags = "-ObjC")]
    

    Refer

    https://forums.xamarin.com/discussion/comment/171420/#Comment_171420
    https://forums.xamarin.com/discussion/comment/135736/#Comment_135736

  • Imran_619Imran_619 Member ✭✭✭

    Generally, the linker does strip out other symbols - mainly for

    Reduce the final size of the executable
    Speed up the execution of the program
    There are two trains of thoughts here:

    When you use the option -O as part of the gcc command line, that is optimizing the code and thus all debugging information gets stripped out, and hence the linker will automatically do the same.
    When you use the option -g as part of the gcc command line, that includes all debugging information so that the executable can be loaded under the debugger with symbols intact.
    In essence those two are mutually exclusive - you cannot have both combined.

    So it depends on which switches did you use for this to happen. Usually, -g switch is for internal debugging and testing prior to public release. The opposite would be something like this -O2 which makes the compiler smart enough to generate a executable that would be considered optimized such as removing dead variables, unrolling loops and so on.

    Hope this helps and gives you the hint

    For more information on mobile app development you can visit Arstudioz

Sign In or Register to comment.