<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/155881>155881</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
OrcV2CBindings examples and the new `LLVMOrcThreadSafeContext` API
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
MrAnno
</td>
</tr>
</table>
<pre>
Hi,
The `OrcV2CBindings` examples have recently changed, as the C function `LLVMOrcThreadSafeContextGetContext()` has been removed in favor of `LLVMOrcCreateNewThreadSafeContextFromLLVMContext()`.
In the new examples:
- A new context and module are created here:
https://github.com/llvm/llvm-project/blob/dff8788d4cc8e5e15bc1f95fabb27cf379ec25ac/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c#L26
https://github.com/llvm/llvm-project/blob/dff8788d4cc8e5e15bc1f95fabb27cf379ec25ac/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c#L29
- A thread-safe module is constructed using the previously mentioned module, but the thread-safe context appears to hold a different context than the module:
https://github.com/llvm/llvm-project/blob/dff8788d4cc8e5e15bc1f95fabb27cf379ec25ac/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c#L57-L62
Could this be an issue?
>From my understanding, `LLVMOrcCreateNewThreadSafeContextFromLLVMContext()` should have been used to wrap the original context instead of creating a new one with `LLVMOrcCreateNewThreadSafeContext()`.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzclE-v4yYUxT8N3ly9yMbxv4UXeWndjvSmU6nT2WO4GCoMEeC8ybevIC_JdCqNWnXVWSUWcODe37mHhaAXiziS5pk0PxRsi8r58b0_WOuK2YnL-LMm9AhAygMpDx8VAmnLD55_osdnbYW2SyBtCfiZrSeDARQ7I3jkaKO5AFfMLiiSAgsQFcIR5GZ51M4moZeXT-8_eP5ReWTiNybx6GzEz_EnjG__CO0JHdIVigWYES14XN0ZBWgLkp2dBye_0Dp6ZBF_wde_iU7erWnT18q7W3XvbH6ixdd7PaQ-XNee4JAX-PUwMCtgdWIzCMwj8HyrAIUer2dAxXjK5-lE6LToqLZ5x91K6GTM-fbzdPLuD-SR0Gk2biZ0ElL2Xd-LPec9Nlg1M6_k0Eg2z7Tjsu4G5LRh_KFzfyydMpkfv_q-k3pmQfPfA1vwG0s7Tmj9QltSHv7nJQwPdDGb4SkwiTdsOiSYIfqNJ3Jb0HbJ_E8ez9ptwVxgRZusijfWycjzFvO2LyXvrjidkPkA0YFyRgADoaVEjzbe90TFrj57k_we3NJ0Ty8tvbb76DYjICqdxhWYBR3ChqSebmOW5hDWC2xWoA-RZcnU2f8yxBBUvjfnT46JLaBIIF49O-V-O68XbZm5k9A2RGQi5Uee32QAlqfcWYRXHdU_etIjSAox1mKoB1bgWHVNWw_dsO8KNQ6ylT0KNiPWnPdUzKIUDW9r3tG5EkOhR1rSpuxpX7XVUHa7vqFcyn1ZllXFRY1kX-LKtNklijvnlyK3dayapu-rwrAZTcgxTmmq4Np0SlOq-zF7Z96WQPal0SGGh0zU0eD4V7yPOE8xd8vEb-R1AnD49V2xeTP-ayfnpyb7vdVyHumfAQAA__-XqjE5">