Reputation: 795
I'm trying to derive a native class compiled from iCarousel native library ( used the LinkWith method described in this example ). When using the generated binding everything works perfectly:
iCarousel carousel = new iCarousel( new RectangleF(0, 0, 300, 300) );
But when trying to create this derived class:
public class Carousel2 : iCarousel
{
public Carousel2( RectangleF rect ) : base(rect)
{
Console.WriteLine("do something");
}
}
and using it like this:
Carousel2 carousel = new Carousel2( new RectangleF(0, 0, 300, 300) );
It compiles but it just stops working, with no error. Is it something I'm missing?
UPDATE: I've put the objective-c header and the ApiDefinition.cs source code here: http://dantes-andreea.blogspot.com/2012/02/icarousel-monotouch-binding-code.html
Upvotes: 1
Views: 304
Reputation: 19335
I think you need to pass -e to btouch when generating the bindings, otherwise they will not be subclassable.
By default btouch does not generate subclassable types because they're a little bit slower.
Update
I was wrong, the -e switch must not be passed to btouch to generate subclassable bindings. Unfortunately this switch is passed unconditionally. A bug report has been filed.
You can probably work around it by manually running the btouch command after MonoDevelop has built the project (you build the bindings project, c&p the btouch command line and remove the -e switch). Then you'll also have to run any subsequent steps manually too.
Upvotes: 2