I want to create a program that modifies another c++ source,compiles it and runs the exe. I mean with something like gcc may be I can but on a windows os gcc may not be present. Is it possible?
From stackoverflow
-
I think your options are fairly limited for windows:
- Check for an install of a compiler (possibly limit this to a short list) and use that compiler
- Bring along a compiler in your application's install package
-
Cowboy answer:
Only if:
- the source code doesn't need a lot of files/headers/libraries
- they can be easily collected by your application
- the application have connection with some server of yours
The application could:
- collect the files in a zip
- send them over the wire to an compiler service (accesible vía HTTP)
- the server compile it with its own installation
- and return the binary executable inside the response.
Of course: it depends on so many variables that seems not very feasible. And the zip+http thing could be difficult from a C/C++ app.
Alexander Ivanov : hmm it can be slow...and it depends on internet connection. But it's interesting idea ;)Steve Jessop : +1 for audacity.helios : Thanks... anyway I was thinking on it and realized about managing zip and http in C... and it was not that nice... :SSteve Jessop : You can (should) grab a library for that sort of thing. Even so it's going to be more work than some languages. As it happens I have implemented both HTTP client and zip file writer libraries in the past: not in C but in a language at about the same level, so I was sitting on top of zlib and a Berkely-style sockets interface. I don't really recommend it, for a very simple http client it's not all that difficult, just very tedious. Use libcurl and libtar instead (tar since compression isn't actually essential here anyway, so keep it simple)...
0 comments:
Post a Comment