cucapra / node-llvmc

JavaScript/TypeScript FFI bindings for the LLVM C API
MIT License
12 stars 7 forks source link

How do you generate Object File Code with this library? #7

Closed William-McGonagle closed 1 year ago

William-McGonagle commented 1 year ago

I've been working on a toy programming language written in Javascript and I need it to compile into an executable. All of the LLVM libraries that I've found written in Javascript only take you as far as IR or Bitcode, but never take you all the way to object code. I know that there are ways inside the LLVM library to generate object code, I'm just wondering if that is supported in this node-llvmc library.

sampsyo commented 1 year ago

We focused this set of bindings on IR generation, so we didn't try to cover other stuff like writing out object files. However, we did include low-level bindings for basically everything in the C API, so the relevant functions are there if you want to try: https://github.com/cucapra/node-llvmc/blob/ee006e228d255f436536bf19c4f71961ea11a050/lib/llvmc.ts#L840-L842

William-McGonagle commented 1 year ago

Thank you so much @sampsyo!

sampsyo commented 1 year ago

No problem; good luck!