[llvm] [offload] Add `dlwrap::loaded` function to check for optional symbols (PR #210737)

Alex Duran via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 04:02:38 PDT 2026


adurang wrote:

> I tested approach proposed by Joseph to use pragma for msvc, but it causes another problem - it's not that easy to tell if original symbol is used or not. It can be done by comparing the pointers of `func` and `func_stub` in a different translation unit, so the compiler will not fold it to false right away, but it also requires `/INCREMENTAL:NO` which seems quite bad to me.
> 
> Another solution could use `GetProcAddress`, but I think it's not worth doing right now. I will disable direct linking on windows for now if it's okay.

I think it's ok. We could also just return "false" for Windows until figure out how to get this in a portable manner or completely remove direct linking.

https://github.com/llvm/llvm-project/pull/210737


More information about the llvm-commits mailing list