Clang-Cl and Coroutines

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Clang-Cl and Coroutines

Richard Smith via cfe-dev

Hey Clang-Team,

 

I’m a big fan of the Clang-cl compiler and its integration into VisualStudio2017 – I use it for private projects and even try to establish the compiler in my company.

 

Today I tried diving into Coroutines – a C++20 feature if I’m not mistaken. I followed a simple tutorial and created a source file, which I will attach to this mail.

Compiling this file with Clang-cl leads to a linker error: “unresolved external symbol _coro_destroy”

 

For me _coro_destoy seems to be the intrinsic for “__builtin_coro_destory” so I made a define statement to replace _coro_destory with the builtin function from Clang. That compiles! But calling the function will lead to a crash…

 

So I decided to go another way, I used the define statement to replace _coro_destory with an external function “_coro_destory2” – I generated an object file with that function, simply calling the _coro_destory intrinsic inside – compiled with MSVC2017. Sadly… this crashes as well…

 

When I compile the code with the VisualStudio compiler, then it works.

 

Long story short: can’t I use Coroutines in Clang-cl? Or in a Visual Studio project with Clan-cl?

 

Kind greetings

Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

CoRoutine.cpp (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Clang-Cl and Coroutines

Richard Smith via cfe-dev

Hey,

 

Seems like… I found a workaround… At least I was able to run co_return and co_yield now…

Basically I just copied the header from Microsoft implementing the feature and replaced certain lines of code with the builtins…

 

I would still be interested in replies to this – maybe I oversaw something or so?

 

Kind greetings

Björn

 

From: cfe-dev <[hidden email]> On Behalf Of Gaier, Bjoern via cfe-dev
Sent: Mittwoch, 2. Januar 2019 13:38
To: [hidden email]
Subject: [cfe-dev] Clang-Cl and Coroutines

 

Hey Clang-Team,

 

I’m a big fan of the Clang-cl compiler and its integration into VisualStudio2017 – I use it for private projects and even try to establish the compiler in my company.

 

Today I tried diving into Coroutines – a C++20 feature if I’m not mistaken. I followed a simple tutorial and created a source file, which I will attach to this mail.

Compiling this file with Clang-cl leads to a linker error: “unresolved external symbol _coro_destroy”

 

For me _coro_destoy seems to be the intrinsic for “__builtin_coro_destory” so I made a define statement to replace _coro_destory with the builtin function from Clang. That compiles! But calling the function will lead to a crash…

 

So I decided to go another way, I used the define statement to replace _coro_destory with an external function “_coro_destory2” – I generated an object file with that function, simply calling the _coro_destory intrinsic inside – compiled with MSVC2017. Sadly… this crashes as well…

 

When I compile the code with the VisualStudio compiler, then it works.

 

Long story short: can’t I use Coroutines in Clang-cl? Or in a Visual Studio project with Clan-cl?

 

Kind greetings

Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr. DE 114 165 789 Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko Lampert, Takashi Nagano, Takeshi Fukushima. Junichi Tajika
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev