I am currently working on a MobClix binding and I have come across this line:
extern NSString* const MCAdsErrorDomain;
That line appears outside any class or interface and I am not sure how to bind it in c#. Any help would be greatly appreciated!
Your definition looks C based so it should work just like Rolf's example tell you.
But if/when you're binding an Objective-C library using the btouch
tool then you will want to use something like:
[Field ("XXMyString")]
NSString MyString { get; }
This is described in details in MonoTouch's binding documentation.
[Field]
should be enough. OTOH you can skip it until you need to use it. That way you'll be able to put it where it belongs (if you ever require it). IOW adding unused [Field]
does not add any value to your bindings - poupou 2012-04-04 21:35
It's done like this:
var handle = Dlfcn.dlopen ("/path/to/mobclix-library", 0);
NSString MCAdsErrorDomain = Dlfcn.GetStringConstant (handle, "MCAdsErrorDomain");
Dlfcn.dlclose (handle);
You can also see a sample here (which includes some error checking too): https://github.com/mono/maccore/blob/master/src/CoreVideo/CVPixelFormatDescription.cs#L67