[cfe-dev] Clang-cl and C Blocks extension

Ivan Donchevskii via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 13 00:48:55 PDT 2018


Hi!
In my experience blocks are almost like lambdas. In many cases it's quite simple to rewrite them using std::function or something similar.


Regards,

Ivan

________________________________
From: cfe-dev <cfe-dev-bounces at lists.llvm.org> on behalf of Shoaib Meenai via cfe-dev <cfe-dev at lists.llvm.org>
Sent: Monday, July 9, 2018 9:57:34 PM
To: Thorben Hasenpusch
Cc: cfe-dev
Subject: Re: [cfe-dev] Clang-cl and C Blocks extension


(adding back cfe-dev)



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?



From: Thorben Hasenpusch <t.hasenpusch at icloud.com>
Date: Monday, July 9, 2018 at 12:40 PM
To: Shoaib Meenai <smeenai at fb.com>
Subject: Re: [cfe-dev] Clang-cl and C Blocks extension



But sadly, when trying to link I get this error: LNK2001: unresolved external symbol __imp__NSConcreteStackBlock.



Do I have to link against something specific?



On 9. Jul 2018, at 21:32, Thorben Hasenpusch <t.hasenpusch at icloud.com<mailto:t.hasenpusch at icloud.com>> wrote:

Thank you! That did the trick.

On 9. Jul 2018, at 21:11, Shoaib Meenai <smeenai at fb.com<mailto:smeenai at fb.com>> wrote:

You can pass "-Xclang -fblocks" on the command line to pass the option to cc1 directly.

From: cfe-dev <cfe-dev-bounces at lists.llvm.org<mailto:cfe-dev-bounces at lists.llvm.org>> on behalf of cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>

Reply-To: Thorben Hasenpusch <t.hasenpusch at icloud.com<mailto:t.hasenpusch at icloud.com>>

Date: Monday, July 9, 2018 at 12:06 PM

To: cfe-dev <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>>

Subject: [cfe-dev] Clang-cl and C Blocks extension

Hi guys,

I’m trying to compile C code that uses the Blocks extension using clang-cl on Windows, via CMake’s LLVM-vs2014 toolset.

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.

Anything I can do?

Thanks,

Thorben

_______________________________________________

cfe-dev mailing list

cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>

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=




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180713/f558f821/attachment.html>


More information about the cfe-dev mailing list