Skip to content
Branch: master
Find file History
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
ARKit
AVFoundation Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
AVKit PMCS Removal (#3197) Feb 5, 2018
Accelerate PMCS Removal (#3197) Feb 5, 2018
Accounts PMCS Removal (#3197) Feb 5, 2018
AddressBook Reuse Libraries.*.Handle instead of dlopen'ing multiple times the sam… Oct 3, 2018
AddressBookUI PMCS Removal (#3197) Feb 5, 2018
AppKit [macos] Always create new NSFont instance when surfacing (#5423) Jan 17, 2019
AssetsLibrary
AudioToolbox Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
AudioUnit [AudioUnit] Adds 'Latency' property [get|set]ter to AudioUnit object (#… Dec 10, 2018
BusinessChat Merge branch 'xcode9.3' Apr 3, 2018
CFNetwork [CFNetwork] Fix CVE 2018-8292 on Mac OS X. (#5271) Dec 14, 2018
CallKit
CarPlay [CarPlay] Update bindings to Xcode 10 Beta 2 Jun 19, 2018
Carbon PMCS Removal (#3197) Feb 5, 2018
ClassKit Fix bindings since 15.7 does not use [p]mcs but csc May 29, 2018
ClockKit [clockkit] Add missing 'CLKComplicationFamily' enum values (#4818) Sep 14, 2018
CloudKit [cloudkit] Review missing 'init' on some types, in particular allow t… Aug 22, 2018
Compression
Contacts
CoreAnimation PMCS Removal (#3197) Feb 5, 2018
CoreBluetooth
CoreData
CoreFoundation [corefoundation] Add missing CFStringTransform API. Fixes #5705 (#5712) Mar 6, 2019
CoreGraphics
CoreImage [CoreFoundation] Fetch a few static values lazily. (#4924) Oct 9, 2018
CoreLocation
CoreML PMCS Removal (#3197) Feb 5, 2018
CoreMedia Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
CoreMidi Reuse Libraries.*.Handle instead of dlopen'ing multiple times the sam… Oct 3, 2018
CoreMotion PMCS Removal (#3197) Feb 5, 2018
CoreServices [mac][coreservices] Add recent/missing enums for FSEvent* API. Fixes #… Jan 9, 2019
CoreSpotlight PMCS Removal (#3197) Feb 5, 2018
CoreTelephony [ios][coretelephony] Update for GM (#4803) Sep 13, 2018
CoreText [runtime] Use mono_array_setref instead of mono_array_set. (#5782) Mar 18, 2019
CoreVideo Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
CoreWlan PMCS Removal (#3197) Feb 5, 2018
Darwin Merge branch 'xcode9.3' into d15-7-merge-xcode9.3 Mar 29, 2018
EventKit
EventKitUI PMCS Removal (#3197) Feb 5, 2018
ExternalAccessory
FinderSync PMCS Removal (#3197) Feb 5, 2018
Foundation [Foundation] Improve/fix NSRegularExpression and NSDataDetector bindi… Apr 10, 2019
GLKit
GameController Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
GameKit
GameplayKit PMCS Removal (#3197) Feb 5, 2018
HealthKit
HomeKit [homekit] Remove export for 'RemoveUser' (iOS prohibited) (#4542) Aug 1, 2018
IOSurface [IOSurface] Update for Xcode10-beta2 (#4322) Jun 22, 2018
ImageCaptureCore [ImageCaptureCore] Add ImageCaptureCore Bindings (#5074) Nov 7, 2018
ImageIO Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
ImageKit
InputMethodKit
Intents [watchos][intents] Enable MediaPlayer related API (now enabled for wa… Jul 26, 2018
JavaScriptCore PMCS Removal (#3197) Feb 5, 2018
LocalAuthentication PMCS Removal (#3197) Feb 5, 2018
MapKit
MediaAccessibility Reuse Libraries.*.Handle instead of dlopen'ing multiple times the sam… Oct 3, 2018
MediaLibrary PMCS Removal (#3197) Feb 5, 2018
MediaPlayer [mediaplayer] Update for beta 4 (#5717) Mar 5, 2019
MediaToolbox
MessageUI PMCS Removal (#3197) Feb 5, 2018
Metal
MetalKit PMCS Removal (#3197) Feb 5, 2018
MetalPerformanceShaders
MobileCoreServices [coreservices] Update up to beta 5 (#4590) Aug 8, 2018
ModelIO PMCS Removal (#3197) Feb 5, 2018
MultipeerConnectivity PMCS Removal (#3197) Feb 5, 2018
NativeTypes PMCS Removal (#3197) Feb 5, 2018
NaturalLanguage [naturallanguage] Fix helper API for `NLTagger.GetTag` and cleanup/fi… Sep 11, 2018
Network [CoreFoundation] Refactor Dispatch code to take advantage of recent c… Oct 11, 2018
NetworkExtension
NewsstandKit PMCS Removal (#3197) Feb 5, 2018
NotificationCenter
ObjCRuntime [bgen] Remove unused Stret.BindingTouch field. Apr 11, 2019
OpenGL [xcode10.2] [OpenGL] Fix MonoMacGameView .ctor when hardware accelera… Feb 27, 2019
OpenGLES Reuse Libraries.*.Handle instead of dlopen'ing multiple times the sam… Oct 3, 2018
PassKit [PassKit] Added support for Xcode 10 up to beta 3. (#4423) Jul 14, 2018
PdfKit
Photos
PhotosUI [photosui] Update for xcode 10.2 beta 1 (#5484) Jan 25, 2019
PrintCore Bind 2 high visibility PrintCore APIs (#4933) Oct 11, 2018
QTKit PMCS Removal (#3197) Feb 5, 2018
QuickLook
QuickLookUI PMCS Removal (#3197) Feb 5, 2018
ReplayKit PMCS Removal (#3197) Feb 5, 2018
SafariServices [safariservices] Updates (some deprecations) for beta 1 (#4206) Jun 11, 2018
SceneKit
ScriptingBridge
SearchKit PMCS Removal (#3197) Feb 5, 2018
Security Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
Simd Merge xcode9 into d15-4[-xi] (#2710) Sep 15, 2017
Social PMCS Removal (#3197) Feb 5, 2018
SpriteKit
StoreKit [storekit] Update for xcode 10.2 b3 (#5634) Feb 20, 2019
System.ComponentModel Build the platform assemblies. Apr 24, 2016
SystemConfiguration Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
TVMLKit [TVMLKit] Work around Apple breaking API for enum values in TVElement… Apr 9, 2019
TVServices PMCS Removal (#3197) Feb 5, 2018
Twitter
UIKit Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
UserNotifications PMCS Removal (#3197) Feb 5, 2018
VideoSubscriberAccount [videosubscriberaccount] Update for beta 1 (#4275) Jun 15, 2018
VideoToolbox Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
Vision
WKWebKit
WatchConnectivity PMCS Removal (#3197) Feb 5, 2018
WatchKit
WebKit [WebKit] Update bindings to Xcode 10 Beta 1, Nothing on beta 2 or 3 (#… Jul 14, 2018
iAd [iAd] Xcode 10 beta 3 support. (#4425) Jul 13, 2018
iTunesLibrary
.gitignore [generator] Build using csproj instead of manual csc command. Partial… Aug 23, 2018
AssemblyInfo.cs.in
Compat.iOS.cs Build the platform assemblies. Apr 24, 2016
Constants.iOS.cs.in [tests] Add introspection tests for Constants.*.cs.in. Fixes #5047 (#… Nov 22, 2018
Constants.mac.cs.in [ObjCRuntime] Verify the system mono version at launch. (#5292) Dec 19, 2018
Constants.tvos.cs.in [tests] Add introspection tests for Constants.*.cs.in. Fixes #5047 (#… Nov 22, 2018
Constants.watch.cs.in [tests] Add introspection tests for Constants.*.cs.in. Fixes #5047 (#… Nov 22, 2018
Makefile [src] Ask mono-cil-strip to be quiet. (#5864) Apr 8, 2019
Makefile.generator Clone files if possible whenever it makes sense. (#5049) Oct 29, 2018
MonoNativeFunctionWrapperAttribute.cs PMCS Removal (#3197) Feb 5, 2018
MonoPInvokeCallbackAttribute.cs PMCS Removal (#3197) Feb 5, 2018
MonoTouch.NUnitLite.templ.csproj [build] Remove MT.D source build and replace it with a binary (#3957) Apr 23, 2018
MonoTouch.NUnitLite.tvos.templ.csproj [build] Remove MT.D source build and replace it with a binary (#3957) Apr 23, 2018
MonoTouch.NUnitLite.watchos.templ.csproj [src] Make project templates MSBuild-compatible. Jan 5, 2017
Obsoletes.cs PMCS Removal (#3197) Feb 5, 2018
OpenTK.dll.sources Build the platform assemblies. Apr 24, 2016
README.md
Version.in Build the platform assemblies. Apr 24, 2016
accelerate.cs Build the platform assemblies. Apr 24, 2016
accounts.cs [accounts] Update for beta 2 (#4297) Jun 20, 2018
addressbook.cs Build the platform assemblies. Apr 24, 2016
addressbookui.cs
adsupport.cs [macos][adsupport] Update for GM (#4800) Sep 13, 2018
appkit.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
arkit.cs [arkit] Fix crash in ARConfiguration.SupportedVideoFormats. Fixes #5347 Jan 4, 2019
assetslibrary.cs PMCS Removal (#3197) Feb 5, 2018
audiotoolbox.cs Build the platform assemblies. Apr 24, 2016
audiounit.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
authenticationservices.cs
avfoundation.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
avkit.cs [AVKit] Update for Xcode10-beta2 (#4314) Jun 21, 2018
bmac [XM] Only use bgen, not bmac[-mobile-mono]. Fixes #3675. (#4785) Sep 13, 2018
bmac.ikvm Create classic snapshot of bgen and update tests/scripts (#3153) Jan 3, 2018
btouch-native.in [generator] Use target framework to determine the platform. (#1690) Feb 17, 2017
btouch.cs [bgen] Remove unused Stret.BindingTouch field. Apr 11, 2019
btouch.in [generator] Use target framework to determine the platform. (#1690) Feb 17, 2017
businesschat.cs Merge branch 'xcode9.3' Apr 3, 2018
bwatch.in Build the platform assemblies. Apr 24, 2016
callkit.cs PMCS Removal (#3197) Feb 5, 2018
carplay.cs
cfnetwork.cs [coreservices] Update up to beta 5 (#4590) Aug 8, 2018
classkit.cs [classkit] Update for xcode 10.2 beta 1 (#5501) Jan 28, 2019
clockkit.cs [ClockKit] Update bindings to Xcode 10.2 Beta 2 (#5549) Feb 5, 2019
cloudkit.cs [cloudkit] Update for xcode 10.2 beta 1 (#5485) Jan 25, 2019
compression.cs
contacts.cs [Contacts] Update bindings to Xcode 10 Beta 4 (#4475) Jul 20, 2018
contactsui.cs [Appkit] Fix xtro DesignatedInitializer output (#3474) Feb 14, 2018
coreanimation.cs
coreaudiokit.cs [CoreAudioKit] Fix macOS xtro output (#3508) Feb 16, 2018
corebluetooth.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
coredata.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
corefoundation.cs [corefoundation] Add missing CFStringTransform API. Fixes #5705 (#5712) Mar 6, 2019
coregraphics.cs PMCS Removal (#3197) Feb 5, 2018
coreimage.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
corelocation.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
coremedia.cs [coremedia] Add BaseFontSizePercentageRelativeToVideoHeight to CMText… Jan 18, 2019
coremidi.cs
coreml.cs [coreml] Update for Xcode 10 GM (#4798) Sep 13, 2018
coremotion.cs [CoreMotion] Update to Xcode 10 Beta 4 (#4478) Jul 20, 2018
corenfc.cs
coreservices.cs Build the platform assemblies. Apr 24, 2016
corespotlight.cs [tests] Add introspection tests to ensure there are native linking in… Jun 11, 2018
coretelephony.cs
coretext.cs [CoreText] Update bindings to Xcode 10 Beta 1 & 2 (#4368) Jul 3, 2018
corevideo.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
corewlan.cs Add xtro test for [Deprecated] attributes and fix up usages (#4966) Jan 29, 2019
custom-make.sh Build the platform assemblies. Apr 24, 2016
devicecheck.cs PMCS Removal (#3197) Feb 5, 2018
error.cs [bgen] Make error reporting work with multiple generators in the same… Apr 11, 2019
eventkit.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
eventkitui.cs PMCS Removal (#3197) Feb 5, 2018
externalaccessory.cs PMCS Removal (#3197) Feb 5, 2018
fileprovider.cs
fileproviderui.cs
findersync.cs [FinderSync] Update to Xcode 10 Beta 4 (#4479) Jul 20, 2018
foundation.cs
frameworks.sources Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
gamecontroller.cs
gamekit.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
gameplaykit.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
generate-frameworks.csharp [bgen] Make the Frameworks class instance based. Apr 11, 2019
generator-attribute-manager.cs [bgen] Make the TypeManager class instance based. Apr 11, 2019
generator-attributes.cs
generator-diff.mk [generator] Exclude pdb files from the diff. (#2287) Jul 4, 2017
generator-enums.cs [bgen] Make Generator.AttributeManager an instance field. Apr 11, 2019
generator-filters.cs
generator-typemanager.cs [bgen] Make the Generator.BindThirdPartyLibrary value dependent on th… Apr 11, 2019
generator.cs [bgen] Add a GeneratedTypes class to avoid having a static GeneratedT… Apr 11, 2019
generator.csproj [bgen] Build the frameworks.g.cs from BUILD_DIR. (#5894) Apr 12, 2019
generator.sln [tests] Port the makefile-based generator tests to NUnit. (#3019) Nov 20, 2017
glkit.cs [glkit] Update (deprecate in favor of Metal) for beta1 (#4245) Jun 14, 2018
global.css Build the platform assemblies. Apr 24, 2016
healthkit.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
healthkitui.cs PMCS Removal (#3197) Feb 5, 2018
homekit.cs [homekit] Remove export for 'RemoveUser' (iOS prohibited) (#4542) Aug 1, 2018
iad.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
identitylookup.cs Merge xcode10.1 into d15-9 (#5063) Oct 31, 2018
identitylookupui.cs [IdentityLookupUI] Add bindings for Xcode 10 Beta 1 (#4281) Jun 16, 2018
imagecapturecore.cs [ImageCaptureCore] Remove redundant availability attribute. Nov 20, 2018
imageio.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
imagekit.cs [ImageCaptureCore] Add ImageCaptureCore Bindings (#5074) Nov 7, 2018
inputmethodkit.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
intents.cs [Intents] Update according to breaking changes from Apple. (#5850) Apr 5, 2019
intentsui.cs [IntentsUI] Update bindings to Xcode 10.2 Beta 2 (#5550) Feb 5, 2019
iosurface.cs [IOSurface] Update for Xcode10-beta2 (#4322) Jun 22, 2018
ituneslibrary.cs [ituneslibrary] Update for xcode10.2 beta 1 (#5489) Jan 28, 2019
javascriptcore.cs [generator] Register models with unique names to not match platform t… Apr 6, 2018
localauthentication.cs PMCS Removal (#3197) Feb 5, 2018
mapkit.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
mediaaccessibility.cs PMCS Removal (#3197) Feb 5, 2018
medialibrary.cs PMCS Removal (#3197) Feb 5, 2018
mediaplayer.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
mediatoolbox.cs Build the platform assemblies. Apr 24, 2016
messages.cs [messages] Updates for beta 1 (#4230) Jun 12, 2018
messageui.cs PMCS Removal (#3197) Feb 5, 2018
metal.cs Clarify usage of `[NullAllowed]` in our bindings (#5417) Jan 16, 2019
metalkit.cs [metalkit] Add 'MTKTextureLoader' missing bindings (fix xtro) (#3561) ( Feb 22, 2018
metalperformanceshaders.cs [MetalPerformanceShaders] Fix some availability attributes (#5680) Feb 28, 2019
mobilecoreservices.cs PMCS Removal (#3197) Feb 5, 2018
modelio.cs
multipeerconnectivity.cs PMCS Removal (#3197) Feb 5, 2018
naturallanguage.cs [naturallanguage] Fix helper API for `NLTagger.GetTag` and cleanup/fi… Sep 11, 2018
network.cs [Network] Update to Xcode 10 beta 3. (#4686) Aug 28, 2018
networkextension.cs
newsstandkit.cs PMCS Removal (#3197) Feb 5, 2018
notificationcenter.cs
opengl.cs Build the platform assemblies. Apr 24, 2016
opengles.cs [opengles] Update for beta 2 (deprecation warnings) (#4366) Jun 29, 2018
opentk.csproj
passkit.cs [passkit] Update for beta 4 (#5716) Mar 5, 2019
pdfkit.cs
photos.cs [Photos] Update bindings to Xcode 10 Beta 4 (#4484) Jul 20, 2018
photosui.cs [Photos] Update for Xcode10-beta2. (#4371) Jul 3, 2018
printcore.cs [PrintCore] Add first pass of bindings (#1067) Nov 2, 2016
pushkit.cs PMCS Removal (#3197) Feb 5, 2018
qtkit.cs [Appkit] Fix xtro DesignatedInitializer output (#3474) Feb 14, 2018
quartzcomposer.cs [macos][quartzcomposer] Update for beta 4 (#4493) Jul 24, 2018
quicklook.cs
quicklookUI.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
replaykit.cs Add xtro test for [Deprecated] attributes and fix up usages (#4966) Jan 29, 2019
rosetta.pl Build the platform assemblies. Apr 24, 2016
safariservices.cs [SafariServices] Update bindings to Xcode 10.2 Beta 1 (#5505) Jan 29, 2019
scenekit.cs
scriptingbridge.cs
searchkit.cs PMCS Removal (#3197) Feb 5, 2018
security.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
social.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
speech.cs PMCS Removal (#3197) Feb 5, 2018
spritekit.cs [Metal/SpriteKit] Fix availability attributes on a few API. (#5033) Oct 24, 2018
storekit.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
system-drawing.sources Build the platform assemblies. Apr 24, 2016
systemconfiguration.cs
touch-unit.sources
tvmlkit.cs [TVMLKit] Work around Apple breaking API for enum values in TVElement… Apr 9, 2019
tvservices.cs
tvuikit.cs [tvos][tvuikit] Update for beta 5 (#4533) Aug 1, 2018
twitter.cs
uikit.cs Merge branch 'xcode10.2' into master-merge-xcode10.2 Apr 3, 2019
usernotifications.cs
usernotificationsui.cs
videosubscriberaccount.cs [videosubscriberaccount] Update for beta 1 (#4275) Jun 15, 2018
videotoolbox.cs Remove 10.7 & 10.8 availability attributes, since they're redundant now. Oct 25, 2018
vision.cs [Vision] Update bindings to Xcode 10 beta 1, nothing in beta 2 (#4321) Aug 1, 2018
watchconnectivity.cs [watchconnectivity] Updates for beta 1 (#4205) Jun 11, 2018
watchkit.cs
webkit.cs Add xtro test for [Deprecated] attributes and fix up usages (#4966) Jan 29, 2019
wkwebkit.cs
xamios.tmpl.csproj
xammac.pc.in Build the platform assemblies. Apr 24, 2016
xammac.tmpl.csproj Remove unnecessary references to Mono.Security. (#5242) Dec 11, 2018
xamtvos.tmpl.csproj [src] Update csproj templates for platform assemblies to build correc… Feb 7, 2018
xamwatch.tmpl.csproj
xkit.cs [NSLayoutManager] Complete bindings for NSLayoutManager. Fixes #4740. ( Jan 29, 2019

README.md

Platform assemblies

This directory contains the source code and build logic to build the platform assemblies.

Generator

The generator takes API definition files (most *.cs files in src/) as input, and generates the required binding code.

There is one generator executable, based on IKVM, that's used to generate the binding code for all platforms.

The generator relies heavily on binding attributes; all the binding attributes (that are not in the platform assembly) are compiled into a separate attribute assembly (Xamarin.[iOS|TVOS|WatchOS|Mac].BindingAttributes.dll).

Since the platform assemblies (and thus all the binding attributes assemblies as well) reference each platform's BCL, those assemblies can't be loaded directly into the generator at runtime. In order to not make the generator code too complicated, all the attributes are also compiled into the generator executable, and then instantiated as mock-objects of the real attributes.

The solution generator.sln can be used to debug the generator. There are multiple run configurations (ios, tvos, watchos, mac-unified, mac-full), each configured to execute the generator with the options for the corresponding profile.

Generator diff

Two special make targets can be used to compare the generated code (.g.cs files) changes between two branches.
This is required when making changes to the generator.

  1. Checkout the clean base branch (e.g master's HEAD) the feature (target) branch is based on.
  2. Do make generator-reference in xamarin-macios/src.
  3. Checkout the feature branch that requires the diff.
  4. Do make generator-diff.

Tip: do git diff | pbcopy in xamarin-ios/src/generator-reference and paste that anywhere (gist for instance).

Conditional compilation

These are the symbols defined for each platform assembly:

Assembly Symbols
monotouch.dll IPHONE MONOTOUCH IOS
Xamarin.iOS.dll IPHONE MONOTOUCH IOS XAMCORE_2_0
XamMac.dll MONOMAC XAMARIN_MAC
Xamarin.Mac.dll MONOMAC XAMARIN_MAC XAMCORE_2_0
Xamarin.WatchOS.dll IPHONE MONOTOUCH WATCH XAMCORE_2_0 XAMCORE_3_0
Xamarin.TVOS.dll IPHONE MONOTOUCH TVOS XAMCORE_2_0 XAMCORE_3_0

To build core for only one platform, use the platform unique variables IOS, MONOMAC, WATCH or TVOS.

Core Assemblies

Currently 2 variations of the core Xamarin.iOS assembly and 4 variations of the core Xamarin.Mac assembly are produced:

### Xamarin.iOS ###

  • A 32-bit Unified assembly (uses System.nint in place of NSInteger, etc.)
  • A 64-bit Unified assembly (same as 32-bit Unified)

### Xamarin.Mac ###

  • A 32-bit Unified assembly (uses System.nint in place of NSInteger, etc.)
  • A 64-bit Unified assembly (same as 32-bit Unified)
  • A 32-bit Full assembly (uses System.nint in place of NSInteger, and references the v4.5 BCL)
  • A 64-bit Full assembly (same as 32-bit Full)

Classic Assemblies

The 32-bit Classic assemblies for iOS and Mac are no longer built and are now copied from the macios-binaries module.

The Classic assembly are copied in, tested, and shipped in order to not break customer code. Customers can choose to continue using this assembly, but we will encourage customers to move to our Unified assemblies.

The Unified assemblies provides many improvements and support for 64-bit iOS and OS X APIs.

Native Types

Most native APIs use NSInteger (and related) typedefs. On 32-bit systems, these are 32-bit underlying types; on 64-bit systems, these are 64-bit underlying types.

Historically Xamarin.iOS and Xamarin.Mac have bound these explicitly as 32-bit (System.Int32, etc). With the move to 64-bit that has been ongoing in OS X for a few versions (10.6/Snow Leopard) and more recently with the anouncement of 64-bit support in iOS, we needed a solution to support both worlds.

We have introduced 6 new types to make this possible:

Native Type Legacy (32-bit) CIL Type New (32/64-bit) CIL Type
NSInteger System.Int32 System.nint
NSUInteger System.UInt32 System.nuint
CGFloat System.Single System.nfloat
CGSize System.Drawing.SizeF CoreGraphics.CGSize
CGPoint System.Drawing.PointF CoreGraphics.CGPoint
CGRect System.Drawing.RectangleF CoreGraphics.CGRect

In the Classic assembly, the System.Drawing types are backed by the 32-bit System.Single type. In the Unified assemblies, the CoreGraphics types are backed by 32/64-bit System.nfloat type.

Enums

Enums are handled specially. Most native enums are backed by NSInteger or NSUInteger. Unfortunately in C#, the backing type of an enum may only be one of the primitive integral C# types. Thus, an enum cannot be backed by System.nint or System.nuint.

The convention is to make all enums that are backed natively by NSInteger or NSUInteger backed by a 64-bit primitive integral C# type (long or ulong) and then annotated with the [Native] attribute. This ensures that API is identical between the 32/64-bit assemblies but also hints to the code generator that Objective-C runtime calls should first cast the enum to a System.nint or System.nuint.

Native Enum Definition

typedef NS_ENUM(NSUInteger, NSTableViewDropOperation) {
	NSTableViewDropOn,
	NSTableViewDropAbove
};

Managed Enum Definition

[Native]
public enum NSTableViewDropOperation : nuint {
	DropOn,
	DropAbove
}

When dealing with enums in P/Invokes, one must never pass such an enum directly. The P/Invoke signature should take a System.nint or System.nuint and a wrapper API must cast the enum manually (as mentioned above, this is handled automatically for Objective-C APIs by the generator).

Objective-C Binding

interface Fooable {
	[Export ("foo:")]
	void Foo (NSTableViewDropOperation dropOp);
}

C Binding

public partial class Fooable {
	[DllImport ("foo")]
	static extern void Foo (nuint dropOp);

	public static void Foo (NSTableViewDropOperation dropOp)
	{
		Foo ((nuint)(ulong)dropOp);
	}
}

#define

There are a few preprocessor variables that can be used within sources for conditional compilation:

Variable Description
MONOMAC defined for Xamarin.Mac builds; not defined for Xamarin.iOS
ARCH_32 defined when the target architecture is 32-bit; this will be defined for Classic and the Unified 32-bit assemblies
ARCH_64 defined when the target architecture is 64-bit; this will be defined only for the Unified 64-bit assembly
XAMCORE_2_0 defined for the Unified assemblies; this should be used for most conditions dealing with API differences between Unified and Classic assemblies
COREBUILD defined when building the intermediate core.dll assembly against which the code generator will produce bindings

For example, to build an API for all of iOS but only 64-bit OS X (Xamarin.Mac):

#if !MONOMAC || (MONOMAC && ARCH_64)
...
#endif
You can’t perform that action at this time.