c3lang / c3c

Compiler for the C3 language
https://c3-lang.org
GNU Lesser General Public License v3.0
2.68k stars 163 forks source link

Maybe standarized stdlib path in future #1398

Closed TymekBrunka closed 2 days ago

TymekBrunka commented 4 weeks ago
~/c3-linux/linux $ c3c compile hw.c3                    
1: module hello_world;
2: import std::io;
          ^^^^^^^
(/home/tymek/Pobrane/c3-linux/linux/hw.c3:2:8) Error: No module named 'std::io' could be found, did you type the name right?

and c3-lang.org wont load for me.

TymekBrunka commented 4 weeks ago

good, there is --stdlib flag to specify stdlib directory

lerno commented 4 weeks ago

c3c looks for the standard library in a bunch of places, including ../lib ../lib/c3 ./lib/c3 ./c3 ./ ../c3 ../ ../../lib/c3 ../../lib

It is unlikely that one setting will work for all OS since they have different conventions. Where would you like for c3c to search?

sa-tasche commented 3 weeks ago

Perhaps it would be useful to offer an environment variable?

lerno commented 3 weeks ago

Yes.

lerno commented 1 week ago

There is now an environment variable C3C_LIB to override this. If this is sufficient, please close the issue.

Caleb-o commented 3 days ago

@lerno can confirm that the C3C_LIB env variable gets used to override. I was able to use a local std lib instead of the original std lib path.

lerno commented 2 days ago

Thank you!