Home > Back-end >  how to make apps fast as c and as crossplatform as web apps?
how to make apps fast as c and as crossplatform as web apps?

Time:01-05

As a personal project I would like to write a large, computationally expensive simulation with some graphics and user inputs at runtime. For that reason it was clear to me that I will be using C as my main language. (I also have a personal preference to use C .)

Then I realized I would like the simulation to be as broadly available (crossplatfrom) as it can be. I guess it might be tedious for potential inexperienced users to use build instructions. For example, as far as I know, a windows user would have to install Make, Git, and a C compiler to run all the necessary commands in the terminal.

I have searched for a bit and now I think my only choices are:

  • assuming the user is skilled enough to follow c build instructions

  • pasting the whole .exe file to OneDrive

  • compile to .wasm (but that would require me to learn it and probably set up a server right?)

  • ignore C assume javascript can handle the computation and host it on github.io

My experience is pretty narrow and (I think) I would like to keep it as close to C as I can.

I also plan to make similiar projects in the future (with crossplatform and computationally expensive requirenments.)

Maybe I am missing something? Any input is highly appreciated :)

CodePudding user response:

Your best bet here is to either use WebAssembly (.wasm) as you yourself suggested, or distributing a binary executable for each platform you want it to be available to. This way, users don't have to recompile the code on each platform. Github provides a way to distribute these precompiled binaries, though I personally have not tried it. If you want to go the wasm way, take a look at Emscripten (https://emscripten.org/), I believe that project provides an extensive toolset that will recompile a many apps from C to wasm without too much work. I know it's not a complete answer but hope it helps.

  • Related