Generating a call to c++ STL function in IR?

Hello :slight_smile: ,

I’m trying to generate LLVM-IR that calls a function from C++ STL (e.g. std::sort() ) .

I need to perform the following steps.

  1. Check whether std::sort() is available in the build environment.
  2. Create a call to std::sort() using IRBuilder.CreateCall()

May I ask for advice on how to perform the 1st step above?
Thank you :rocket:

std::sort, like most STL function can’t be just “available in the build environment”: these are templated functions that needs to be instantiated for C++ types, and then dispatch to a comparison operator that depends on the C++ types.
You would have better chance looking for C-library level functions, like qsort.

1 Like