Hans Roger Nymo - 2005-08-05

I've seen that some people has problems with the length of the commandline on Microsoft OS'es.

I've been searching for a solution on this problem, and this is what I discovered:

According to Microsoft's Article 830473:
Win NT & Win 2000 = 2047 characters (max length)
Win XP = 8191 (max length)

So when I looked in the code for cpptask it has a method getMaximumCommandLength() for all supportet compilers and linkers.
This method returns a integer value of 1024 regardless of Microsoft flawor.

I've added some logic in this methodfor my compiler:
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioCCompiler.java

OLD:
public int getMaximumCommandLength() {
  return 1024;
}
-----------------------------------------------------------------
NEW:
public int getMaximumCommandLength() {
  int max = 2046;
  if (System.getProperty("os.name").toLowerCase().equals("windows xp")){
    max = 8190;
  }
  if (System.getProperty("os.family").toLowerCase().equals("win9x")){
    max = 1024;
  }
  return max;
}
-----------------------------------------
The following files I found when doing a "grep" for getMaximumCommandLength and 1024:
cpptask/src/net/sf/antcontrib/cpptask/arm/ADSLinker.java
cpptask/src/net/sf/antcontrib/cpptask/borland/BordlanCCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/borland/BordlanLibrarian.java
cpptask/src/net/sf/antcontrib/cpptask/borland/BordlanLinker.java
cpptask/src/net/sf/antcontrib/cpptask/borland/BordlanResourceCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/compaq/CompaqVisualFortranCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioCCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioCompatibleLibrarian.java
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioCompatibleLinker.java
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioMIDLCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/devstudio/DevstudioResourceCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/intel/IntelWin32CCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/intel/IntelWin64CCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/ti/ClxxCCompiler.java
cpptask/src/net/sf/antcontrib/cpptask/ti/ClxxLibrarian.java
cpptask/src/net/sf/antcontrib/cpptask/ti/ClxxLinker.java

Hopes this helps some of you!! ;-)