Thread: *.COM Files? Writing them?

  1. #1
    Registered User
    Join Date
    May 2002
    Posts
    83

    *.COM Files? Writing them?

    How do u write *.COM files. are they like batch files, or are they compiled? ive tried searching google but couldn't find anything. sorry to bug u.
    "What this country needs is more free speech worth listening to." - -Hansell B. Duckett

  2. #2
    com files and exe files are the same I guess... (?)

  3. #3
    Registered User Commander's Avatar
    Join Date
    Sep 2001
    Posts
    801
    i really doubt it, one system's command file won't run in another system..that's the not the same with exes
    oh i'm sorry! i didn;t realize my fist was rushing to meet ur face!

    MSN :: [email protected] []*[]

  4. #4
    Blank
    Join Date
    Aug 2001
    Posts
    1,034
    .com files are different than .exe files. Checkout www.wotsit.org

  5. #5
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,743
    .com files and .exe files are different.

    there are several ways to compile to a .com rather than a .exe.

    The first way I ever compiled to a .com was using the DOS debug utility. I would write programs in assembly and it would allow you to save them as .com files.

    You can also make .com files using a linker. At least I think that is what it is called....correct me if I am wrong. When you first compile a program it makes an object file, from there it can make either a .com or a .exe file using the linker. I have not tried this with C++ programs, but I have tried it with my Assembly programs and it works. I havent tried it for C++ because generally I just use .exe's for my C++ programs.
    My Website

    "Circular logic is good because it is."

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    com files must be kept extremely small (by today's standards). that's why they were abandoned for exe files. com files are in essence flat binaries.

    you can assemble com files using dos's debug program. you can also assemble com files through nasm. all com files also start at 100h.

  7. #7
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    > ive tried searching google but couldn't find anything

    When I looked into COM (I bought several books), I also had problems in understanding it due to the junk marketing lingo put about by Microsoft.

    While I don't use COM myself, here's what I now understand.

    1. COM is a binary object packaging technology. I.e. you can distribute your compiled object tools, but keep your source code to yourself.

    2. COM files are essentially DLLs. Instead of exporting flat function calls, you export objects (or to be precise pointers to objects)

    3. There are serious compatibility issues in sharing compiled object orientated resources between different compilers in Windows because compilers rarely agree on the binary format of objects.

    4. To overcome this, COM relies on pointers to pure virtual base classes. This is a standard technique, and is not unique to COM. However, because MS want you to believe that it is their technology, they never explain this. However, for this to work, different compilers must agree on the same v-table format of objects. This is generally the case.

    5. Significantly, COM adopts an approach in which a COM DLL contains only one COM class. Therefore, any program built around COM will typically use a large number of COM binary files. The linkage between COM objects and the corresponding binary files is done through the windows registry. In other words, the code in your program is dependent upon the registry at very deep level. I.e. your program says I want a new instance of this object, and the registry defines which binary file to load. This is all done behind the scenes to the developer.

    6. Like many other object technologies, COM has an independent type language (IDL). In otherwords you define the declaration of your class (the header file in effect) and an IDL utility will produce the skeletal code needed to access it in your chosen language.

    Hope this helps
    Last edited by Davros; 07-09-2002 at 10:20 PM.

  8. #8
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812

    Futhermore...

    7. It appears MS is abandoning COM. If not, why have they developed MSIL (byte code in effect) for .Net?
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  9. #9
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    that's a different kind of com, there...

  10. #10
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    no, it's not

  11. #11
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by Xterria
    no, it's not
    LMFAO....

    Yes it is....

    There's an old executable format that ends with the .com extention......its different from the .exe version and M$ more or less abandoned it ages ago....that's why most PE executables these days are all .exe......some old linkers still support .com linkage.......TLINK.exe (TASM) for example

    Component Object Model is a technology from M$ that allows an interface led programming method and allows you to use objects with all languages that support COM (VB,VBScript,Delphi,C++,J++)....
    Last edited by Fordy; 07-10-2002 at 02:15 AM.

  12. #12
    Code Monkey Davros's Avatar
    Join Date
    Jun 2002
    Posts
    812
    >There's an old executable format that ends with the .com extention

    Oh... I remember those. I think.
    OS: Windows XP
    Compilers: MinGW (Code::Blocks), BCB 5

    BigAngryDog.com

  13. #13
    >There's an old executable format that ends with the .com extention

    Oh... I remember those. I think.
    Do a HD search. I found 53 .COM files. The majority were in the Windows dir but some came with older apps I've got installed such as QBasic, Turbo Pascal. There even appears to be a REM.COM in DJGPP. Does nobody remember Edit.Com? And where do you get off calling 'em old!? I beg your pardon, sonny.

    </Pointless Rant>
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  14. #14
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Originally posted by lightatdawn


    Do a HD search. I found 53 .COM files. The majority were in the Windows dir but some came with older apps I've got installed such as QBasic, Turbo Pascal. There even appears to be a REM.COM in DJGPP. Does nobody remember Edit.Com? And where do you get off calling 'em old!? I beg your pardon, sonny.

    </Pointless Rant>
    Was that Win2k and above?

    There are hang-ons........and the loader still recognises the format...but they are pretty basic programs (more or less raw binary) and they dont have the extra info an .exe will.

    I downloaded a specific virus sweep from Norton a while back and I noticed that was a .com file.........they had a reason to use that format I suppose

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with writing to files
    By beanroaster in forum C++ Programming
    Replies: 10
    Last Post: 12-23-2007, 12:21 AM
  2. Reading & Writing files (Error)
    By Blackroot in forum C++ Programming
    Replies: 9
    Last Post: 01-10-2006, 11:55 AM
  3. Writing Compressed Image Files
    By BenBartle in forum C++ Programming
    Replies: 1
    Last Post: 03-09-2005, 08:55 PM
  4. Writing files to a CD
    By SyntaxBubble in forum Windows Programming
    Replies: 1
    Last Post: 04-16-2003, 04:43 PM
  5. Making files, opening them, and writing to them
    By Unregistered in forum Game Programming
    Replies: 6
    Last Post: 06-18-2002, 09:57 PM