My programming ramblings

Objective-C blocks on Windows with Clang

Posted on March 25, 2012 by Paul

In my last post I’ve shown you how to develop Objective-C code on Windows with Clang and GNUstep. I’ve also presented a small Objective-C program that uses the new ARC syntax.

Today I will show you how to compile on Windows an Objective-C program that contains blocks. Strictly speaking Apple’s blocks syntax is an extension to the C language.

A block in Objective-C is similar with lambdas and closures from other languages. The purpose of this article is not to give you an exhaustive introduction to the block syntax. My intention here was only to show you how to enable the block syntax in Objective-C on Windows.

This a small Objective-C code that exemplifies the use of block syntax:

Disclaimer:All data and information provided on this site is for informational purposes only. solarianprogrammer.com makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. solarianprogrammer.com does not collect any personal information about its visitors except that which they provide voluntarily when leaving comments. This information will never be disclosed to any third party for any purpose. Some of the links contained within this site have my referral id, which provides me with a small commission for each sale. Thank you for understanding.