What is the easiest way to call my cpp library from llvm

I’m using llvm to generate code. I want to call a cpp library in the generated code. The library and my code will be linked in the last phase. I have many functions in that cpp library, and the name is mangled up with namespace. How can I achieve that in the easiest way?

The easiest is to write the API in C and limit yourself to primitive types (integer/float/pointers), no struct).
If this is overly restrictive, there is no straightforward solution as far as I know, but many elaborated one.
Here is a blog post about FFI with Clang DragonFFI: FFI/JIT for the C language using Clang/LLVM - The LLVM Project Blog ; there was also a talk a few years ago at the LLVM dev meeting: https://llvm.org/devmtg/2014-10/Slides/Skip%20the%20FFI.pdf (the recording should be on YouTube)

Almost the same concept: