You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This may be the last thing I need to do before I can start working on a self-hosted compiler (#116).
Let's say you want to write a C or Jou program that uses LLVM:
On Windows, you give a path to LLVM-C.lib as a command-line argument to the linker, and you make sure that a somewhat large collection of DLL files is available when the program runs. You need to download these files by either running LLVM's installer or by extracting them from LLVM's installer without running the installer.
On Linux, before you compile the program, you need to run sudo apt install llvm-11-dev on terminal to install LLVM. Then you can run a terminal command llvm-config-11 --ldflags --libs (where 11 is the LLVM version), which prints something like -L/usr/lib/llvm-11/lib -lLLVM-11. These are flags that you need to give to the linker.
In other words: it is a mess, and what exactly you need to do depends on your OS. Maybe some day there will be a Jou package manager that handles the mess for you.
But for now, I think it would be good enough if you could specify linker flags in Jou code. You still need to download/install the external library some os-specific way, but at least it would be possible to use it. Maybe a linker_flags keyword? Something like this:
ifWINDOWS: # Code inside this would be compiled only on windows.linker_flags"lib/LLVM-C.lib"else:
linker_flags"-L/usr/lib/llvm-11/lib -lLLVM-11"declareLLVMSomeFunction(...)
defmain() ->int:
LLVMSomeFunction(...)
return0
The text was updated successfully, but these errors were encountered:
This may be the last thing I need to do before I can start working on a self-hosted compiler (#116).
Let's say you want to write a C or Jou program that uses LLVM:
LLVM-C.lib
as a command-line argument to the linker, and you make sure that a somewhat large collection of DLL files is available when the program runs. You need to download these files by either running LLVM's installer or by extracting them from LLVM's installer without running the installer.sudo apt install llvm-11-dev
on terminal to install LLVM. Then you can run a terminal commandllvm-config-11 --ldflags --libs
(where11
is the LLVM version), which prints something like-L/usr/lib/llvm-11/lib -lLLVM-11
. These are flags that you need to give to the linker.In other words: it is a mess, and what exactly you need to do depends on your OS. Maybe some day there will be a Jou package manager that handles the mess for you.
But for now, I think it would be good enough if you could specify linker flags in Jou code. You still need to download/install the external library some os-specific way, but at least it would be possible to use it. Maybe a
linker_flags
keyword? Something like this:The text was updated successfully, but these errors were encountered: