home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!fuug!demos!kiae!glas!demos!usenet.ins!po.CWRU.Edu!jjk
- From: jjk@po.CWRU.Edu
- Newsgroups: comp.lang.c
- Date: 17 Jul 92 18:05 MDT
- Subject: Re: Compatibility between Microsoft-C a
- Sender: Notesfile to Usenet Gateway <notes@glas.apc.org>
- Message-ID: <1992Jul17.140520.8318@usenet.ins>
- References: <4z+mbaf.prastogi@netcom.com>
- Nf-ID: #R:4z+mbaf.prastogi@netcom.com:1279130672:1992Jul17.140520.8318@usenet.ins:-1056406313:001:2228
- Nf-From: po.CWRU.Edu!jjk Jul 17 18:05:00 1992
- Lines: 44
-
-
-
- >How different is Microsoft-C Compild module and Borland C compiled modules.
- >DO they follow different conventions for generating the assembly code and the
- >object code. Is it possible to link object modules and libraries generated by
- >different compilers.
-
- So far I've found three major differences:
-
- 1. Microsoft puts the stack in the default data segment regardless
- of memory model, whereas Borland puts the stack in the default data
- segment only in the "small data" models (tiny, small, & medium).
- This is easily taken care of by setting the SS=DS option in the
- Options | Compiler | Code Generation menu to "Always".
-
- 2. Some of the library's code may access Microsoft-specific globals
- or internal run-time library functions. If this occurs, your
- program will not link. If you have the Microsoft run-time library
- (xLIBCE.LIB) you can link it in to resolve the references. Two
- warnings: first, the xLIBCE.LIB must come after the Borland Cx.LIB
- in the link. Using the IDE puts Cx.LIB last by default. You must
- provide for this inside your Project window. Second, there may be
- name collisions for dissimilar items, or functions that behave differ-
- ently.
-
- 3. Finally, the method in which floating point values are returned from
- functions differs. Borland returns floats, doubles, and long doubles
- on ST(0), or in the floating point emulator's top of stack if you aren't
- using the coprocessor. Microsoft returns them into static variables.
- (See the Borland C++ Programmer's Guide's "Interfacing With Assembly
- Language" chapter and the Microsoft Macro Assembler Programmer's
- Guide's "Mixed-Language Programming" chapter for full explanations).
- What this basically means is that a Microsoft-generated function calling
- the run-time library will get Borland's function and (a) the function
- will not return the value where the calling function looks for it and
- (b) your floating-point stack overflows quickly, since values are not
- being popped from it. If anyone has a solution to this problem, I'd
- like to know.
-
- Jeff Kellam
- banshee@natinst.com
- --
- jjk@po.cwru.edu
-
-