Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create binding for 2 dependent static libraries in Xamarin.iOS

I have an issue with binding on Xamarin.iOS.

I have 2 libraries: libA.a libB.a

And libB.a is depend on libA.a classes. In libA I have this class:

namespace ABC {
    [BaseType (typeof (NSObject))]
    public partial interface ClassAbc {
        [Export ("setString:")]
        void SetString (string abc);
    }
}

And in libB I have this code:

namespace ABCUsage {
    [BaseType (typeof (NSObject))]
    public partial interface ClassAbcUsage {
        [Export ("setAbc:")]
        void SetAbc (ClassAbc abc);
    }
}

I have no source code of libA.a and libB.a but only universal static libraries and headers.

I tried to add libA binding project and final A.dll as a Reference for libB binding but it says "namespace ABC not found".

How should I make a correct binding for libB?

like image 930
Slava Chernikoff Avatar asked May 04 '14 18:05

Slava Chernikoff


1 Answers

Hello you can bind as many libraries as you want in a single binding project, just make sure you specify fully qualified type names

namespace ABC {
    [BaseType (typeof (NSObject))]
    public partial interface ClassAbc {
        [Export ("setString:")]
        void SetString (string abc);
    }
}

namespace ABCUsage {
    [BaseType (typeof (NSObject))]
    public partial interface ClassAbcUsage {
        [Export ("setAbc:")]
        void SetAbc (ABC.ClassAbc abc);
                    //^^^^^
    }
}

Hope this helps.

like image 168
dalexsoto Avatar answered Oct 21 '22 01:10

dalexsoto