Qutard
Qutard

Reputation: 355

HOW to get FILE handle in LLVM on windows

I'm trying to implement a script interpreter on windows using LLVM C++ API.there's a perl-like statement like

myInput=<stdin>;

i don't want to use similar function in C and link them with it.So how to bind or something like that to STDIN or a more generic FILE handle with LLVM APIs?

Upvotes: 0

Views: 71

Answers (1)

Eli Bendersky
Eli Bendersky

Reputation: 273656

You can easily use external functions from the LLVM Interpreter, see lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp. In this case, you can use the C library's fgets to read stdin, or define a more convenient wrapper around it which your script can invoke directly. Note that the LLVM interpreter or JIT can find such functions within the LLVM process itself since it always links with the C runtime, so you don't need to open additional DLLs.

Upvotes: 1

Related Questions