Im new in MonoTouch. I am currently trying to bind an Objective-C library into MonoTouch, so far I’ve done much of the work, however, i don’t know how to bind the following code :
static inline NSString* UmRet_lookup(UmRet c) {
#define URLOOK(a) case a: return @#a;
switch (c) {
URLOOK(UMRET_SUCCESS )
URLOOK(UMRET_NO_READER )
URLOOK(UMRET_SDK_BUSY )
URLOOK(UMRET_ALREADY_CONNECTED)
URLOOK(UMRET_NOT_CONNECTED )
URLOOK(UMRET_LOW_VOLUME )
URLOOK(UMRET_UF_INVALID_STR )
URLOOK(UMRET_UF_NO_FILE )
URLOOK(UMRET_UF_INVALID_FILE )
default: return @"<unknown code>";
}
#undef URLOOK
}
And also the next code :
#define UMLOG_ERROR @"[UM Error] "
#define UMLOG_WARNING @"[UM Warning] "
#define UMLOG_INFO @"[UM Info] "
You cannot bind this as it’s not really Objective-C code but some C pre-processor directives.
In such cases you need to rewrite this into C#. This looks to be some translation of error codes into string representation. Depending on your app you might want to use C# strings (instead of
NSString).The other defines should be converted into C# static, e.g.
Again you might want to use C#
string(and turn them intoconsttoo).