[Mono-osx] Help marshaling NSFormatter method

Geoff Norton grompf at gmail.com
Fri Aug 26 21:09:55 EDT 2011


ByRef strings are currently not supported (NSString should work tho).  Please file a bug and assign it to me.

-g

On 2011-08-26, at 9:06 PM, Mattiello Joseph wrote:

> 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
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx



More information about the Mono-osx mailing list