is all the .obj or .o file compatible?

Discussion in 'C Programming' started by Danny Lu, Aug 15, 2005.

  1. Danny Lu

    Danny Lu Guest

    Can anyone tell me if all the .obj or .o files are compatible?
    Danny Lu, Aug 15, 2005
    #1
    1. Advertising

  2. Danny Lu

    Flash Gordon Guest

    Danny Lu wrote:
    > Can anyone tell me if all the .obj or .o files are compatible?


    This is not a C question, and therefore not on topic here.

    <OT>
    No, they are not all compatible. A .o file for Linux is very unlikely to
    work on Windows.
    </OT>

    If you want anything more specific about object files, please ask on a
    group dedicated to your system, NOT here.
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
    Flash Gordon, Aug 15, 2005
    #2
    1. Advertising

  3. "Danny Lu" <> wrote in message
    news:...
    > Can anyone tell me if all the .obj or .o files are compatible?

    They aren't.
    Alex
    Alexei A. Frounze, Aug 15, 2005
    #3
  4. Danny Lu

    Default User Guest

    Danny Lu wrote:

    > Can anyone tell me if all the .obj or .o files are compatible?


    No, they aren't.



    Brian
    Default User, Aug 15, 2005
    #4
  5. Danny Lu

    Jaspreet Guest

    Danny Lu wrote:
    > Can anyone tell me if all the .obj or .o files are compatible?


    No way, they are platform dependant plus have a whole lot of other
    dependencies. If they were compatiable you would be looking at a
    picture similar to compiling on one platform and executing it on
    another which is not true.
    Jaspreet, Aug 15, 2005
    #5
  6. In article <>,
    Jaspreet <> wrote:

    >Danny Lu wrote:
    >> Can anyone tell me if all the .obj or .o files are compatible?


    >No way, they are platform dependant plus have a whole lot of other
    >dependencies. If they were compatiable you would be looking at a
    >picture similar to compiling on one platform and executing it on
    >another which is not true.


    What you write is more or less right, but I think it gives a bit
    of the wrong impression.

    Different operating systems do generally use different object file
    formats, sometimes supporting multiple object file formats on one
    OS. But the object file format is a different question, really,
    then what instruction set a particular platform supports.

    Some object file formats support multiple executable portions (for
    different instruction sets, or for 32 bit vs 64) within the same object
    file; an example of this is Apple's announcement that object files
    would share PowerPC and Intel executables.

    Unix-like systems tend to adopt one of a small number of object file
    formats, so that they do not need to "reinvent the wheel". Some of the
    format names are "COFF" (older, use is declining); "ELF" (not as old,
    but not fresh); "dwarf" (newer). gcc supports ELF and dwarf formats; I
    do not know at the moment if COFF format is being maintained in gcc.

    A consequence of this is that object files have a tendency to be
    cross-platform compatible (in the sense that the same tool would be
    able to extract debugging and link data) -- even when the
    instruction set of the binaries is incompatible. The situation
    is sort of like the way that most countries agree on standardized
    letter and parcel sizes, so a letter can go from one country to
    another, even though the -contents- of the letter might be
    unintelligable to most people in the destination country.
    --
    Any sufficiently old bug becomes a feature.
    Walter Roberson, Aug 16, 2005
    #6
  7. Danny Lu

    Chris Torek Guest

    In article <ddr7lh$9lr$>
    Walter Roberson <-cnrc.gc.ca> wrote:
    >Unix-like systems tend to adopt one of a small number of object file
    >formats, so that they do not need to "reinvent the wheel". Some of the
    >format names are "COFF" (older, use is declining); "ELF" (not as old,
    >but not fresh); "dwarf" (newer). ...


    Off-topic technical note: "dwarf" is not an object file format,
    while "ELF" is. (Dwarf and dwarf-2 are debugging data sub-formats
    normally appearing within ELF files. The GNU binutils can use
    either "stabs" or dwarf within ELF files.)
    --
    In-Real-Life: Chris Torek, Wind River Systems
    Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
    email: forget about it http://web.torek.net/torek/index.html
    Reading email is like searching for food in the garbage, thanks to spammers.
    Chris Torek, Aug 16, 2005
    #7
  8. Danny Lu

    Tim Prince Guest

    Flash Gordon wrote:
    > Danny Lu wrote:
    >
    >> Can anyone tell me if all the .obj or .o files are compatible?

    >
    >
    > This is not a C question, and therefore not on topic here.

    I'd be surprised if many people could use C without dealing with one or
    the other.
    Perhaps the OP meant "all obj and .o files intended for use with C
    compilations."
    Aside from the various format possibilities, and possibility of
    incompatible instruction sets, these files are likely to contain
    references to the run-time libraries of a specific compiler and/or a
    specific OS version. At the very least, they depend on specific header
    files, at a lower level than the compatibility implied in C standard.
    Tim Prince, Aug 16, 2005
    #8
  9. Hi danny,

    No, .obj and .o files are not comaptible.
    though both are relocatable file but are in different format.
    the scope of both is same(i.e. compiled source,relocatables) but are
    platform dependent.
    usually, .o is format of relocatable files or compiled files in
    Unix/Linux variant while .obj is compiled ouput for windows based.

    so, i hope this clears your doubt.

    rgrds,
    Munish Nayyar
    emanshu "Innovative MInd"
    emanshu, Munish Nayyar, Aug 16, 2005
    #9
  10. Danny Lu

    Tim Prince Guest

    emanshu, Munish Nayyar wrote:
    > Hi danny,
    >
    > No, .obj and .o files are not comaptible.
    > though both are relocatable file but are in different format.
    > the scope of both is same(i.e. compiled source,relocatables) but are
    > platform dependent.
    > usually, .o is format of relocatable files or compiled files in
    > Unix/Linux variant while .obj is compiled ouput for windows based.
    >
    > so, i hope this clears your doubt.
    >

    This only confuses the issue. .o and .obj files on Windows are usually
    interchangeable, aside from the fact that they are usually built against
    different headers and libraries, but your explanation seems to
    contradict that. .o and .obj files can be renamed either way, without
    making a difference to tools which accept both. As others will no
    doubt point out again, the C standard says nothing about which name you
    give them.
    Tim Prince, Aug 16, 2005
    #10
  11. Emmanuel Delahaye, Aug 16, 2005
    #11
  12. On Tue, 16 Aug 2005 03:42:33 GMT, in comp.lang.c , Tim Prince
    <> wrote:

    >Flash Gordon wrote:
    >> Danny Lu wrote:
    >>
    >>> Can anyone tell me if all the .obj or .o files are compatible?

    >>
    >> This is not a C question, and therefore not on topic here.


    >I'd be surprised if many people could use C without dealing with one or
    >the other.


    So would I but that doesn't make it ontopic. Consider that you'd be
    equally surprised if many people could use C without the letter i, or
    a computer of some sort, or electricity, or access to oxygen.

    --
    Mark McIntyre
    CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
    CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
    Mark McIntyre, Aug 16, 2005
    #12
  13. In article <JgdMe.1519$Z%>, Tim Prince <> writes:
    > Flash Gordon wrote:
    > > Danny Lu wrote:
    > >
    > >> Can anyone tell me if all the .obj or .o files are compatible?

    > >
    > > This is not a C question, and therefore not on topic here.

    >
    > I'd be surprised if many people could use C without dealing with one or
    > the other.


    I don't believe there's any limit to the number of people who could
    use EPM C on the AS/400, which does not use anything called a ".obj
    file" or a ".o file", or even anything roughly equivalent to those
    things on the platforms where they do appear. (Some C implementations
    for the '400 do have something that is in some ways similar to an
    "object file", but it doesn't have a name that contains ".obj" or
    ".o".)

    However, the point is moot; it's still OT for comp.lang.c. Few people
    "use C" (in the sense of writing C programs) without a keyboard; that
    doesn't make questions about keyboards on-topic here.

    --
    Michael Wojcik

    Unfortunately, as a software professional, tradition requires me to spend New
    Years Eve drinking alone, playing video games and sobbing uncontrollably.
    -- Peter Johnson
    Michael Wojcik, Aug 17, 2005
    #13
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Kamoski
    Replies:
    3
    Views:
    15,683
    Jay B. Harlow [MVP - Outlook]
    Aug 9, 2003
  2. Phil Endecott

    Obj* ptr = new Obj(X)

    Phil Endecott, Jun 3, 2005, in forum: C++
    Replies:
    5
    Views:
    462
    Mark P
    Jun 3, 2005
  3. Shalabh Chaturvedi
    Replies:
    2
    Views:
    443
    Mike C. Fletcher
    Feb 20, 2004
  4. Matthew Thorley

    How do you convert a string obj to a file obj?

    Matthew Thorley, May 4, 2005, in forum: Python
    Replies:
    7
    Views:
    502
    Peter Otten
    May 4, 2005
  5. pantagruel
    Replies:
    0
    Views:
    241
    pantagruel
    Feb 17, 2006
Loading...

Share This Page