Mail Archives: djgpp/1997/10/16/19:41:44
At 08:53 10/16/1997 GMT, mihasan AT odin DOT fli DOT sh DOT bosch DOT de wrote:
>
>Hi,
>
>we have a large project on DOS entirely written in C with the
>GNU C Compiler. But we now find that we can't link
>the gcc object files with a library written in Borland C.
>Unfortunately we don't have the sources for that specific
>library.
>
>The library has the extension .obj, while the GNU object files
>have the extension .o. Even if we rename the Borland library from
>.obj to .o, we get the link message "File not recognized: File
>format not recognized".
>
>What object file format is used on DOS, what is the
>name of the object file format that gcc creates, and
>how can the two be linked?
This is actually an FAQ. You can get the FAQ list as faq*.zip from where you
got DJGPP, and the relevant sections are 17.5 and 17.6. The short answers to
your questions are:
1. DOS uses the DOS OBJ file format, something invented by IBM or Micro$oft
or something.
2. DJGPP uses the COFF format, which is an old Unix standard object file format.
3. They can't be linked. There is a tool to convert the file formats, see
the FAQ reference, but unless the code was written for a 32-bit flat memory
model with the same calling conventions, etc., as GCC, it won't work. Since
your library was written for Borland C, it's 1e6 to 1 that it wasn't written
that way. FAQ section 17.6 lists some solutions, but most of them are tons
of work and only should be used in desperation.
Sorry, I don't know what to say. Your best bet might be to either get the
source, somehow; use a different library for which you do have source and
port it, or rewrite the library.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -