Create exe with exe?

Blitz3D Forums/Blitz3D Programming/Create exe with exe?

BLaBZ(Posted 2009) [#1]
Is it possibly to have a blitz application create an application?

Thanks!


Matty(Posted 2009) [#2]
I see no reason why not, but it's not part of the standard command set, you'd have to make a compiler etc - I think mark posted one a long time ago in the code archives , a very simple compiler.


Warner(Posted 2009) [#3]
In theory, yes. You can write bytes to a file. If these bytes form an executable, it can be run by windows.
Suppose you read all the bytes of an executable, and you put these numbers after a bunch of "Data" statements. Then your program can create a file and write all these bytes into it. You then have made an exact copy of the exe file, and it can be run.

But I suppose your question means more than just writing an exe file? In that case, you would need to write a compiler. A first step could be looking at the compiler that Mark wrote. It is in the code archive. The instructions that it outputs should be converted into numbers, then you can write these numbers as bytes into a file. Then it should run.

You could also make your program output source code, and then use an existing compiler to convert it into an executable. Maybe MinGW? If you only need it for yourself, you could even have your program write BB code, and then compile it using blitzcc.

Another option could be using a scripting language. A good one is GameScript:
http://www.blitzbasic.com/Community/posts.php?topic=69531