xamarin / binding-tools-for-swift

MIT License
157 stars 21 forks source link

fixed boolean marshaling return values #816

Closed stephen-hawley closed 7 months ago

stephen-hawley commented 7 months ago

This fixes about 20 tests for funcs that return boolean values. In swift land, booleans are return only in the bottom bit and apparently .NET 7 doesn't handle things quite the same way as Xamarin did. Oops.

I fixed this by changing the statically bound methods that return bool to have [return: MarshalAs (UnmanagedType.I1)] and added code to the pinvoke generator which will attach that attribute to the pinvokes that return bool. In the process, I added a convenience factory method to CSAttribute which makes it easier to generate an attribute as a one-liner.