c# - how to create binding for an extern declaration -
i'm trying create binding ios library.
when creating native app library, requires include .h header file declares global applicationkey variable this:
extern const unsigned char applicationkey[];
and supposed implement
const unsigned char applicationkey[] = {0x11, ... };
now, when creating xamarin binding library, header file mapped objective sharpie to
partial interface constants { // extern const unsigned char [] applicationkey; [field ("applicationkey")] byte[] applicationkey { get; } }
how change able set applicationkey c# code?
your apidefination.cs file should
[basetype (typeof(nsobject))] public partial interface constants { [export ("applicationkey")] typeofproperyinnativecode applicationkey { get; set; } }
in order access property create instance of constant class of binding project , access
binding.constant cons= new binding.constant(); cons.applicationkey =value;
for better understanding can follow link http://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/walkthrough_binding_objective-c_library/
Comments
Post a Comment