Build an exe from another exe

G

GatlingGun

Hi everyone, I need to make another exe from my app.
For example there are some app that compare two file and then buil
another exe with the different (patcher).
Help me please! :)

10x
 
M

Mike Wahler

Hi everyone, I need to make another exe from my app.
For example there are some app that compare two file and then buil
another exe with the different (patcher).
Help me please! :)

There are no facilites in C++ to directly do what
you're asking. How an executable is formed is
dependent upon the host system. However, once
you figure that out, you can use C++ to open an
output file (std::eek:fstream) and write any bits
to it you want. (You'll want to open the file in
'binary mode').

For further details about how to do what you want,
try consulting support resources concerning your
particular system(s).

-Mike
 
R

robertwessel2

Mike said:
There are no facilites in C++ to directly do what
you're asking. How an executable is formed is
dependent upon the host system. However, once
you figure that out, you can use C++ to open an
output file (std::eek:fstream) and write any bits
to it you want. (You'll want to open the file in
'binary mode').


I can think of several platforms where you *cannot* write an executable
file without non-standard extensions. Several mainframe platforms, for
example, implement executables as structured file types (not byte
streams), and need to be written as such (and not as a simple binary
byte stream).
 
R

rossum

I can think of several platforms where you *cannot* write an executable
file without non-standard extensions. Several mainframe platforms, for
example, implement executables as structured file types (not byte
streams), and need to be written as such (and not as a simple binary
byte stream).
An alternative would be not to write the executable binary directly,
but to generate a file of source code and call a compiler to compile
that source code into the executable in whatever format would be
required.

rossum
 
R

robertwessel2

rossum said:
An alternative would be not to write the executable binary directly,
but to generate a file of source code and call a compiler to compile
that source code into the executable in whatever format would be
required.


Sure, there's a lot to recommend that approach, not least is
eliminating the tedium of actually generating object code and
executables directly. Of course it requires a great deal of
infrastructure to be installed and available on your system (very few
Windows systems have an installed C compiler, for example), and how you
get that to happen will be very system specific.
 
G

GatlingGun

Perfect, Thx.
So, I can embed a minimal installation of MinGW (for example) or for
who have alredy mingw a version that ready system variables(for
Windows) or use shell (*nix).
Yes I think this is perfect... just for curiosity there are another
way?

thanks to all :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top