LLJIT: Help: how to add a archive?

Hello everyone

Unless I misunderstood the class LLJIT, there is no function to add a archive (.lib on Windows or .a on Linux) to the instance of LLJIT, but one can only add an object or a IR module. I am trying to JIT the code below and need this Windows library: legacy_stdio_definitions.lib

HelloWorld.c
extern int printf(char*, …);
int main() {
printf(“Hello World!\n”);
return 0;
}

What did I miss?

Rdgs

FA

Hi Francis,

You can use the StaticLibraryDefinitionGenerator class to expose symbols from a static library (archive). You create an instance using its static Load() method, then add the instance to the LLJIT by calling JITDylib::addGenerator(). I haven’t tried this on Windows, though.

Geoff

Also, you might want to try it with lli first:

lli -jit-kind=orc -extra-archive=legacy_stdio_definitions.lib HelloWorld.ll

In case it doesn’t work, adding --debug-only=orc can provide a lot of debug output, that can be useful for a first glimpse what’s going on.

Cheers