<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi!<br>
In my experience blocks are almost like lambdas. In many cases it's quite simple to rewrite them using std::function or something similar.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Regards,</p>
<p style="margin-top:0;margin-bottom:0">Ivan</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> cfe-dev <cfe-dev-bounces@lists.llvm.org> on behalf of Shoaib Meenai via cfe-dev <cfe-dev@lists.llvm.org><br>
<b>Sent:</b> Monday, July 9, 2018 9:57:34 PM<br>
<b>To:</b> Thorben Hasenpusch<br>
<b>Cc:</b> cfe-dev<br>
<b>Subject:</b> Re: [cfe-dev] Clang-cl and C Blocks extension</font>
<div> </div>
</div>
<meta content="text/html; charset=utf-8">
<meta name="x_Generator" content="Microsoft Word 15 (filtered medium)">
<style>
<!--
@font-face
{font-family:"Cambria Math"}
@font-face
{font-family:Calibri}
p.x_MsoNormal, li.x_MsoNormal, div.x_MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
a:x_link, span.x_MsoHyperlink
{color:blue;
text-decoration:underline}
a:x_visited, span.x_MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
p.x_msonormal0, li.x_msonormal0, div.x_msonormal0
{margin-right:0in;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif}
span.x_EmailStyle18
{font-family:"Calibri",sans-serif;
color:windowtext}
.x_MsoChpDefault
{font-size:10.0pt}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.x_WordSection1
{}
-->
</style>
<div lang="EN-US" link="blue" vlink="purple">
<div class="x_WordSection1">
<p class="x_MsoNormal"><span style="color:black">(adding back cfe-dev)</span></p>
<p class="x_MsoNormal"><span style="color:black"> </span></p>
<p class="x_MsoNormal"><span style="color:black">You'll need to link against a blocks runtime library. compiler-rt provides one (under lib/BlocksRuntime). I haven't tried building that under Windows, but I do see some _WIN32 defines in the source code, so hopefully
it should work?</span></p>
<p class="x_MsoNormal"> </p>
<div style="border:none; border-top:solid #B5C4DF 1.0pt; padding:3.0pt 0in 0in 0in">
<p class="x_MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt; color:black">From:
</span></b><span style="font-size:12.0pt; color:black">Thorben Hasenpusch <t.hasenpusch@icloud.com><br>
<b>Date: </b>Monday, July 9, 2018 at 12:40 PM<br>
<b>To: </b>Shoaib Meenai <smeenai@fb.com><br>
<b>Subject: </b>Re: [cfe-dev] Clang-cl and C Blocks extension</span></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">But sadly, when trying to link I get this error: LNK2001: unresolved external symbol __imp__NSConcreteStackBlock.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Do I have to link against something specific?</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<blockquote id="x_MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="border:none; border-left:solid #B5C4DF 4.5pt; padding:0in 0in 0in 4.0pt; margin-left:3.75pt; margin-right:0in">
<div>
<p class="x_MsoNormal" style="margin-left:.5in">On 9. Jul 2018, at 21:32, Thorben Hasenpusch <<a href="mailto:t.hasenpusch@icloud.com">t.hasenpusch@icloud.com</a>> wrote:</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Thank you! That did the trick.</p>
</div>
<blockquote id="x_MAC_OUTLOOK_ATTRIBUTION_BLOCKQUOTE" style="border:none; border-left:solid #B5C4DF 4.5pt; padding:0in 0in 0in 4.0pt; margin-left:3.75pt; margin-right:0in">
<div>
<p class="x_MsoNormal" style="margin-left:.5in">On 9. Jul 2018, at 21:11, Shoaib Meenai <<a href="mailto:smeenai@fb.com">smeenai@fb.com</a>> wrote:</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">You can pass "-Xclang -fblocks" on the command line to pass the option to cc1 directly.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">From: cfe-dev <<a href="mailto:cfe-dev-bounces@lists.llvm.org">cfe-dev-bounces@lists.llvm.org</a>> on behalf of cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Reply-To: Thorben Hasenpusch <<a href="mailto:t.hasenpusch@icloud.com">t.hasenpusch@icloud.com</a>></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Date: Monday, July 9, 2018 at 12:06 PM</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">To: cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Subject: [cfe-dev] Clang-cl and C Blocks extension</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Hi guys,</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">I’m trying to compile C code that uses the Blocks extension using clang-cl on Windows, via CMake’s LLVM-vs2014 toolset.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">The compilation errors out, telling me I’d need to enable blocks by passing “-fblocks” to clang, however clang-cl doesn’t recognize that flag.</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Anything I can do?</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Thanks,</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">Thorben</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">_______________________________________________</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in">cfe-dev mailing list</p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a></p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fXBg7mDMRpD5aFTwSkVGzQm_l-nEhQH52nOfnloTUfQ&s=eHXwWPv2JNzLoZeGlAh0qgOk3shPlYskr6yRzxNvjE0&e=">https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=fXBg7mDMRpD5aFTwSkVGzQm_l-nEhQH52nOfnloTUfQ&s=eHXwWPv2JNzLoZeGlAh0qgOk3shPlYskr6yRzxNvjE0&e=</a></p>
</div>
</blockquote>
</blockquote>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
<div>
<p class="x_MsoNormal" style="margin-left:.5in"> </p>
</div>
</div>
</div>
</body>
</html>