Restored from previous forum. Originally posted by cor.
Has someone a example or starting point to make an exe file from within PB.
I need this to make my own executables for a program i'am designing.
Already Searched for PE -file format , but cannot find a good and complete resource.
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
Write selfmade exe file
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ricardo.
Did you want to develop a compiler????
Some software works as pseudo-compilers, that is:
Having an interpreter that reads at the end of itself for a script. When they 'compile' takes the runtime (the interpretar without the script) that is some file with the .exe changed to anyother and paste to it the script and rename it as executable.
That goves the idea that you are creating executables that do what the user write on his script.
Otherwise you need to build a compiler...
Best Regards
Ricardo
Dont cry for me Argentina...
Did you want to develop a compiler????
Some software works as pseudo-compilers, that is:
Having an interpreter that reads at the end of itself for a script. When they 'compile' takes the runtime (the interpretar without the script) that is some file with the .exe changed to anyother and paste to it the script and rename it as executable.
That goves the idea that you are creating executables that do what the user write on his script.
Otherwise you need to build a compiler...
Best Regards
Ricardo
Dont cry for me Argentina...
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by LJ.
At the end of every .exe file is what is known as "the stack". The stack is simply a place to store things. So once you create the .exe file, you know what is the last byte of the stack (this is why you create an .exe that reads from a text file first because the size of your .exe will change). When you have completed your .exe program, use the file byte commands to know what is the last byte of your program. Now when you attach the .txt to the end of the .exe, you start reading the data from the last byte +1. One author I know cut right into the stack of his .exe insisting that Windows allocated more than necessary room for the stack anyway so it doesn't matter. I think that 1 or 2 bytes off in the stack is okay, but if windows creates the stack area of an .exe to be a certain size, I like to keep it that way. Good luck.
Take it in baby steps. First make a program that reads from a simple .txt file to do things. Then, take the .txt file an append it to the end of your .exe and instead of having your .exe read from the .txt file, have it read from it's own tail (the end of the .exe file).Originally posted by cor
Has someone a example or starting point to make an exe file from within PB.
I need this to make my own executables for a program i'am designing.
Already Searched for PE -file format , but cannot find a good and complete resource.
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
http://www.ready4music.com
http://www.chordplanet.com
At the end of every .exe file is what is known as "the stack". The stack is simply a place to store things. So once you create the .exe file, you know what is the last byte of the stack (this is why you create an .exe that reads from a text file first because the size of your .exe will change). When you have completed your .exe program, use the file byte commands to know what is the last byte of your program. Now when you attach the .txt to the end of the .exe, you start reading the data from the last byte +1. One author I know cut right into the stack of his .exe insisting that Windows allocated more than necessary room for the stack anyway so it doesn't matter. I think that 1 or 2 bytes off in the stack is okay, but if windows creates the stack area of an .exe to be a certain size, I like to keep it that way. Good luck.
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Num3.
Take a look at SFX_TEST here:
http://www.reelmediaproductions.com/pb/ ... ppets.html
It's what you need.
In simple steps
Create the your exe.
Append your txt to the end of the of the exe.
Create a function to retrieve the txt from the end of the exe.
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...
Take a look at SFX_TEST here:
http://www.reelmediaproductions.com/pb/ ... ppets.html
It's what you need.
In simple steps
Create the your exe.
Append your txt to the end of the of the exe.
Create a function to retrieve the txt from the end of the exe.
--
Kind Regards
Rui Carvalho
Old programmers never die... They branch into a subroutine...