X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Lines: 59 X-Admin: news AT aol DOT com From: sterten AT aol DOT com (Sterten) Newsgroups: comp.os.msdos.djgpp Date: 08 Feb 2004 06:24:43 GMT References: <200402071458 DOT i17EwZtr013586 AT envy DOT delorie DOT com> Organization: AOL Bertelsmann Online GmbH & Co. KG http://www.germany.aol.com Subject: Re: attaching source code to the ececutable Message-ID: <20040208012443.22711.00001133@mb-m19.aol.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com >> no, it's for the potential user or email-friend who has got the .exe >> from you and now wants to see its sourcecode. > >So include a command line option to print the includes source. are you saying, the source is included in the .exe by default ? Well, then it must be somehow encrypted since I can't find it. Hmm, I could also put the source itself into a string and add it to the source before compiling it. >> I have many programs with text attached and never observed any >> problems. > >DJGPP programs? I think, yes. Although I'm not sure how exactly DJGPP programs are defined. I found the string "DJGPP libc built Dec 24 2001 21:24:39 by GCC 2.8.1" in my program. >> I assume that the attached text isn't loaded, when the program is >> executed. DOS/Windows looks for the length of the program in the >> .exe header and then only loads to RAM the number of bytes specified >> there, and ignores the rest. > >Right, that's 2048 bytes for all djgpp programs. to be sure that I understand this correctly : The exe-header of the executables always specify a length of 2048 bytes, and only 2048 bytes of the program are loaded to RAM and then eventually later the .exe-file is opened again and additional code is loaded ? So, e.g. can I switch directories from within a DJGPP program or delete/rename/move/open the executable itself ? >> So there can only be problems, if the program opens the .exe files >> itself, (like my sourcecode-printing routine does) e.g. for >> computing a checksum. > >It does. That's how ALL djgpp programs work. DJGPP programs are >*already* a program with data attached to it. So, you can't do what >you want with DJGPP. like attaching additional data ? BTW. here is my batch file which I use for compiling: rem this is the file gc.bat which I use to compile .c programs set djgpp=c:\djgpp\djgpp.env set path=c:\djgpp\bin;%path% gcc %1.c -O2 -o %1.exe strip %1.exe echo ----------------------------------------- >>%1.exe echo ----------------------------------------- >>%1.exe echo ----------------------------------------- >>%1.exe type %1.c >>%1.exe Guenter.