Mail Archives: djgpp/1997/10/16/22:32:31
mihasan AT odin DOT fli DOT sh DOT bosch DOT de wrote:
>
> 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?
>
> Any help would be very much appreciated
DJGPP uses the COFF object format, which is incompatible with the .OBJ
format used by Borland, et. al. But there are many more differences
between the two than simply the object code format.
DJGPP produces 32-bit flat model protected mode code, while most other
DOS compilers produce 16-bit segmented real mode code. Even if you can
persuade the compiler to produce flat model code, it still must meet the
stringent requirements of protected mode: it cannot directly access
conventional memory (and thus memory-mapped hardware devices), cannot
set or handle interrupts, and cannot interface with DOS. All of these
tasks are handled differently in protected mode.
There are some cases where code depending on 16-bit libraries can be
converted without much pain to use a DJGPP equivalent; the best example
is Borland Graphics Interface (BGI) code. So many people needed this
that a special library was written to convert this code to work with the
GRX graphics library designed for DJGPP. 'bccgrx20.zip' is available
from any SimTel mirror in the 'v2tk' directory.
Most other code that violates the rules of protected mode must be
ported. If you understand the requirements of this library, you ought
to be able to port it to an equivalent DJGPP library without too much
trouble, or design your own library to accomplish the same task in
protected mode.
For a complete description of this extremely common problem, you should
consult chapter 17 of the DJGPP Frequently Asked Questions list
(v2/faq210b.zip from SimTel mirrors or online at
http://www.delorie.com/djgpp/v2faq/). Chapter 18 gives tips on
designing your own hardware interface code in DJGPP. The short answer,
however, is that it's most unlikely that you will be able to get
Borland-compiled object code to work with DJGPP.
--
---------------------------------------------------------------------
| John M. Aldrich | "Money is truthful. If a man speaks |
| aka Fighteer I | of his honor, make him pay cash." |
| mailto:fighteer AT cs DOT com | |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -