[Mono-osx] Help marshaling NSFormatter method
Mattiello Joseph
mail at joemattiello.com
Fri Aug 26 21:06:37 EDT 2011
NSFormatter uses a lot of output parameters of types like NSString **. I've found that when NSError** 's are used mono uses "out NSError". I've tried doing the same with both "out string" and "out NSString" but I continue to get bus errors with the following.
[Export ("isPartialStringValid:newEditingString:errorDescription:")]
public bool IsPartialStringValid(string partialString, out string newString, out string error){
error = "";
newString = "";
if(partialString.Length <= this.length)
return true;
newString = partialString.Substring(0, this.length);
return false;
}
I've also tried with out NSString newString where newString = new NSString("foo");
I only get a bus error when encountering the false case immediately after return. I'm assuming that Cocoa isn't able to understand the memory passed to it. I haven't been able to backtrack in gdb, maybe I'm doing it wrong.
Any help would be greatly appreciated. This is driving me nuts. And the NSFormatter class is actually incomplete on a method that also uses NSString** so I'll pass any input forward to fix that.
Many thanks,
- Joe
More information about the Mono-osx
mailing list