FbcDos limitations

DOS specific questions.
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

FbcDos limitations

Postby Dinosaur » May 25, 2008 5:19

Hi all

I have raised this issue once before, and managed to solve it by compiling and then linking seperately.

However, I now have the same problem, but linking seperately wont solve it.
This works'

Code: Select all

C:
Path c:\FBEdit\FreeBasic;
cd\FBEdit\Projects\Concrete

FbcWin -c Win01.bas
FbcWin -c Win02.bas
FbcWin -c Win03.bas
FbcWin -c WinHelp.bas
FbcWin -c RunMod00.bas
FbcWin -c RunMod01.bas
FbcWin -c RunMod02.bas
FbcWin -c RunMod10.bas

FbcWin Win00.bas -a Win01.o Win02.o Win03.o WinHelp.o RunMod00.o RunMod01.o RunMod02.o RunMod10.o -v -l cgui -l alleg  -x Concrete.exe
This wont work.

Code: Select all

C:
Path c:\FBEdit\FreeBasic;
cd\FBEdit\Projects\Concrete

Fbcdos -c Win01.bas
Fbcdos -c Win02.bas
Fbcdos -c Win03.bas
Fbcdos -c WinHelp.bas
Fbcdos -c RunMod00.bas
Fbcdos -c RunMod01.bas
Fbcdos -c RunMod02.bas
Fbcdos -c RunMod10.bas

Fbcdos Win00.bas -a Win01.o Win02.o Win03.o WinHelp.o RunMod00.o RunMod01.o RunMod02.o RunMod10.o -v -l cgui -l alleg  -x Concrete.exe
I get the error.

Code: Select all

The system cannot execute the specified program.
Obviously the limits in Dos are different then in Windows, but is there any way the developers can solve this problem, as this is severely limiting my use of FreeBasic.
The total of all these basic files is only 129kb.(I havent expanded the functionality yet)
Take one of the files out of the linking statement, and it will compile, but ofcourse reports errors of missing functions.

Yes, I can combine the files and it will work, but I like to keep seperate modules for seperate functions.

Regards

Edit:Version 0.18.5 (04-17-2008) for dos (target:dos)
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » May 25, 2008 6:26

Your command line, including the fbcdos and the space following it, is 135 bytes. AFAIK for a DOS app it needs to be 128 bytes max, with the actual command tail, which includes the leading space, 126 bytes max (so it will fit in the PSP with the leading byte that specifies the length and the trailing CR, both supplied by the system).

Edit: I did a test. Make that 127 bytes max for the total length.
Last edited by MichaelW on May 25, 2008 6:43, edited 1 time in total.
1000101
Posts: 2556
Joined: Jun 13, 2005 23:14
Location: SK, Canada

Postby 1000101 » May 25, 2008 6:32

You're best bet for compiling is setting up a response file. Unfortunately, I think, the program has to support response files, the OS doesn't handle it directly.
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Postby Dinosaur » May 25, 2008 7:52

Hi all

MichaelW, I removed all the "-v -l cgui -l alleg -x Concrete.exe" and it compiled and must have found the required libraries. Except it was named after the first .bas file "Win00.exe"

So, why the limit ?
Surely most of the Dos developers are using a windows (or Linux) editing tool.

What are the options, 1000101 suggestion of a response file ?
I use a batch file, but that is just another way of putting the string into a command line.

Is there any other solution. ?

Regards
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » May 25, 2008 9:57

It's DOS that is limiting the length of the command line. For a simple solution you could do something like this in your batch file:

Code: Select all

copy Win01.o    1.o
copy Win02.o    2.o
copy Win03.o    3.o
copy WinHelp.o  4.o
copy RunMod00.o 5.o
copy RunMod01.o 6.o
copy RunMod02.o 7.o
copy RunMod10.o 8.o

Fbcdos Win00.bas -a 1.o 2.o 3.o 4.o 5.o 6.o 7.o 8.o -v -l cgui -l alleg -x Concrete.exe

for %%f in (1.o 2.o 3.o 4.o 5.o 6.o 7.o 8.o) do del %%f

The GNU Make docs indicate that Make can work with MS-DOS. Perhaps it has some automated method that can get around the command line length limit without your having to manually rename files.
Last edited by MichaelW on May 25, 2008 10:15, edited 1 time in total.
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Postby Dinosaur » May 25, 2008 10:03

Hi all

Thanks Michael, I will run with that untill a better solution is available.

Regards
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Postby DrV » May 25, 2008 13:59

All DJGPP programs (that use the standard libc, anyway) can use response files; just write the command line options in a text file, then run, for example, 'fbc @myopts.txt'.
rugxulo
Posts: 216
Joined: Jun 30, 2006 5:31
Location: Usono (aka, USA)
Contact:

Postby rugxulo » May 25, 2008 16:13

Yes, it's true, Windows doesn't (anymore??) allow > 128 lengths of DOS cmdlines (dunno why). DOS compatibility isn't a priority for them anymore (ahem, Vista).

Yes, GNU make (or bash) for DOS will definitely allow long cmdlines because both are meant to be used seamlessly when porting from *nix (which isn't DOS-friendly, they use VERY long cmdlines). Give one of them a try (although the two previously-mentioned workarounds should work fine too).

http://gd.tuwien.ac.at/pc/dos/djgpp/bet ... ak381b.zip
http://gd.tuwien.ac.at/pc/dos/djgpp/bet ... 05bbr2.zip
Antoni
Posts: 1393
Joined: May 27, 2005 15:40
Location: Barcelona, Spain

Postby Antoni » May 25, 2008 16:37

The Win32 version of FB is capable of cross-compiling, so you could compile your DOS programs without command line limitations.
All that's required is to have the dos sub-folders of the dos version in \inc and \lib of the Win32 version and add to the command line -target dos
Laaca
Posts: 22
Joined: Dec 31, 2007 14:24

Postby Laaca » May 26, 2008 15:48

In DOS 7.x and compatibles you can use for command line the CMDLINE environment variable if you don't want to use PSP
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Postby Dinosaur » May 27, 2008 23:03

Hi all

sorry for the lack of response, but been travelling again.

After testing some of the options, got some weird results.
I tested on a project that is known to be OK.
The files are the same files I am compiling for Win or for Dos.

Test1.
With MichaelW's method of copying to 1.o etc, no problems & no compile errors.
Test2
With Drv's suggestion of respose files.

Code: Select all

Contents of MakeDosExe.bat
C:
Path c:\FBEdit\FreeBasic;
cd\FBEdit\Projects\FrontEnd
Fbcdos @MakeDosExe.txt

Contents of MakeDosExe.txt
Win01.BAS
Win02.BAS
WinHelp.BAS
RunMod00.BAS
RunMod01.BAS
RunMod02.BAS -v -l cgui -l alleg -x FrontEnd.exe

Win02.o:fake:(.text+0x24cb): undefined reference to `MAIN_WINDOW3'
RunMod00.o:fake:(.text+0x10a6): undefined reference to `E_STOP'
RunMod00.o:fake:(.text+0x10e7): undefined reference to `E_STOP'


With Antoni's suggestion of using -target dos , the only problem was that the compiler didnt like a capitalized Dos, it needed dos, but compiled without problems.But I really need to look into the differences (if any) between the Dos compiler & Win with -target dos.

I have checked the files and the declares are intact, and all files and libraries are where they are suppose to be.
Why do I get compile errors with one method and not the other.

Regards

Edit: Please ignore my ramblings, I made an error copying and that was the reason for the error.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Postby DOS386 » May 29, 2008 7:48

The Win32 version of FB is capable of cross-compiling, so you could compile your DOS programs without command line limitations.


This indeed might help, but typing >128 chars on commandline is not the biggest fun, and, even worse, not being able to compile a DOS application on DOS can hardly be considered as a "feature" :-(

Edit: Please ignore my ramblings, I made an error copying and that was the reason for the error.


All DJGPP programs (that use the standard libc, anyway) can use response files; just write the command line options in a text file, then run, for example, 'fbc @myopts.txt'.


So your problem is now finally fixed using DrV's hint ? ;-)

Not being able to read unreasonably long options from a file is IMHO a critical design fault, while the 128 bytes limit of DOS shouldn't really hurt ;-)

Windows doesn't (anymore??) allow > 128 lengths of DOS cmdlines (dunno why). DOS compatibility isn't a priority


I don't care about "Windows" ;-)
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Postby Dinosaur » May 29, 2008 11:07

Hi all

Yes, the response file solution works.
The only downside is that you cant do it in one batch file.
(I use a batch file in the Fbedit compile command)
So now there is one batch file setting the path, and the statement
"FbcDos @makeExex.txt" and of course the second txt file with all the files
to be compiled and linked.

Regards
rugxulo
Posts: 216
Joined: Jun 30, 2006 5:31
Location: Usono (aka, USA)
Contact:

Postby rugxulo » May 30, 2008 20:47

Dinosaur wrote:
Yes, the response file solution works.
The only downside is that you cant do it in one batch file.
(I use a batch file in the Fbedit compile command)
So now there is one batch file setting the path, and the statement
"FbcDos @makeExex.txt" and of course the second txt file with all the files
to be compiled and linked.



You can always do this:

Code: Select all

@echo off
if exist myfile.txt goto start
echo blah1.bas blah2.bas > myfile.txt
:start
fbc @myfile.txt


If you'd prefer being more discreet, use "%TEMP%." [sic] as the path prefix for your temporary response file. (The '.\' allows TEMP to work even if its value ends in '\' or not.)
Dinosaur
Posts: 1267
Joined: Jul 24, 2005 1:13
Location: Searcy AR USA
Contact:

Postby Dinosaur » May 30, 2008 22:20

Hi all

I guess I have to be a bit more carefull about making statements like
you cant do it in one batch file.

and be more specific and say
I cant do it in one batch file.


Regardless, thanks for all your help.

Regards

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 14 guests