holzschu / a-Shell-commands

shell commands, pre-compiled to webAssembly, ready to use in a-Shell
554 stars 21 forks source link

Clang etc ... can or how any program be run #7

Open kwccoin opened 3 years ago

kwccoin commented 3 years ago

Great work. Use it a lot to ssh to others.

Seems you can compile some program. But after compilation like clang then ... (or they product a.out which is wasm?)

But I guess only wasm can be run?

Btw there is no ~/Documents/bin folder. Needed to be created? Then try to create wasm?

holzschu commented 3 years ago

Hi,

thanks a lot for the kind words.

Yes, you can use clang to compile C and C++ programs. By default, clang produces webAssembly programs, which can be executed with "wasm a.out".

If you used the "-o" option of clang to create "executable.wasm", then a-Shell will call "wasm executable.wasm" if you type "./executable" on the command line, or "executable" if it is in a directory in the $PATH.

You can use clang to produce other binaries (arm64, x86), but they cannot be run on iOS with the current limitations.

~/Documents/bin and ~/Library/bin are in the default $PATH. You have to create them if you want to (many users don't). Once they are created, any command you place here (wasm, python, lua) will be executed if you type its name. a-Shell will try to guess the nature of the command based on the #! on the first line (for Python and Lua scripts) or based on the name (for webAssembly commands).