[an error occurred while processing this directive] Node:Symlinks, Next:, Previous:Packages, Up:Miscellany

22.5 How to create symbolic links to programs

Q: How do I create symbolic links?

Q: I have this program that behaves differently depending on the name it's called. Under Unix, I just create symbolic links to achieve that, but DOS doesn't support links. Do I have to put several identical programs under different names on my disk??

A: DJGPP allows you to simulate symbolic links to programs. Generate a stub (which is a small DOS program attached to every DJGPP program by the stubify.exe program), call it by the name of the link you want, then edit its header to run another program. For example, let's say the real program is dj1.exe and we want to make a link called dj2.exe that really calls dj1.exe. First, generate a stub under the name dj2.exe. Next, run STUBEDIT to modify the new program's stub info block and change the name of the executable it runs. In this case, we'd change it to dj1:

 C:\USR\BIN> stubify -g dj2.exe
 C:\USR\BIN> stubedit dj2.exe runfile=dj1

Voila! Now, when you run dj2, it tells the stub to load the image of dj1, but pass "dj2" in argv[0].

If you use the DJGPP port of GNU Fileutils 3.13 or later, the ln program there can do the above steps for you if you say this (like on Unix):

 ln -s dj1.exe dj2.exe


[an error occurred while processing this directive]