[comp.std.c] Mixing compilers

bengsig@oracle.nl (Bjorn Engsig) (09/27/89)

This was taken over from comp.lang.c:

Article <524@crdos1.crd.ge.COM> by davidsen@crdos1.UUCP (bill davidsen) says:
|  Using libraries compiled with one compiler with programs compiled with
|another is always a possible cause of problems with calling sequences.
|-- 
Does the pANS say anything about linking programs compiled with
different compilers, e.g. in the case above.  You might even not know
which compiler was used to compile the libraries.
-- 
Bjorn Engsig, bengsig@oracle.nl, bengsig@oracle.com, mcvax!orcenl!bengsig

henry@utzoo.uucp (Henry Spencer) (09/28/89)

In article <514.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>|  Using libraries compiled with one compiler with programs compiled with
>|another is always a possible cause of problems with calling sequences.
>|-- 
>Does the pANS say anything about linking programs compiled with
>different compilers...

No.  How could it?  This is the most implementation-specific of
implementation-specific characteristics.  What you are doing, in
essence, is using two compilers as parts of the overall implementation.
Clearly, if the different parts of the implementation don't get along,
you are in deep trouble.

>You might even not know
>which compiler was used to compile the libraries.

You *need* to know that its calling conventions are compatible with the
one you are using.
-- 
"Where is D.D. Harriman now,   |     Henry Spencer at U of Toronto Zoology
when we really *need* him?"    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

gwyn@smoke.BRL.MIL (Doug Gwyn) (09/28/89)

In article <514.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>Does the pANS say anything about linking programs compiled with
>different compilers, e.g. in the case above.  You might even not know
>which compiler was used to compile the libraries.

Of course not.  How could it?

I understand your concern, but it's not the C Standard's job to
address such issues.  Compiler vendors and the computer vendor
should address such system-specific issues.  For example, DEC
supposedly has a language interface standard for VAXes.

barmar@kulla (Barry Margolin) (09/28/89)

In article <1989Sep27.170646.2313@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>In article <514.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>>You might even not know which compiler was used to compile the libraries.
>You *need* to know that its calling conventions are compatible with the
>one you are using.

This is why calling conventions, data type layouts, and object file
formats (including limitations on external symbol names) are best
specified by OS vendors, or even by separate standards organizations
(e.g. COFF), rather than by compiler implementors.  After a program is
compiled, it shouldn't matter what language it was written in, what
compiler was used to compile it, etc.
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar

bph@buengc.BU.EDU (Blair P. Houghton) (09/29/89)

In article <514.nlhp3@oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>This was taken over from comp.lang.c:
>Article <524@crdos1.crd.ge.COM> by davidsen@crdos1.UUCP (bill davidsen) says:
>|  Using libraries compiled with one compiler with programs compiled with
>|another is always a possible cause of problems with calling sequences.
>
>Does the pANS say anything about linking programs compiled with
>different compilers, e.g. in the case above.  You might even not know
>which compiler was used to compile the libraries.

Why?

I can link Fortran and assembler routines with my C code.  Why would
X3J11 have anything to say about that other than "Good Luck" ?

Once things are in machine code, how would the pANS apply at all?

Waitasec...  _Is_ there a prohibition in the pANS that says that one
can't use a full set of object-libraries, one that provides all of the
required routines, each with conforming behavior, that were compiled,
say, with SNOBOL?

				--Blair
				  "And what's the release date on
				   the ANS?"

henry@utzoo.uucp (Henry Spencer) (09/30/89)

In article <4382@buengc.BU.EDU> bph@buengc.bu.edu (Blair P. Houghton) writes:
>Waitasec...  _Is_ there a prohibition in the pANS that says that one
>can't use a full set of object-libraries, one that provides all of the
>required routines, each with conforming behavior, that were compiled,
>say, with SNOBOL?

The pANS doesn't require that the libraries be compiled at all.  You can
enter them in binary from the front-panel switches (assuming you still
have a machine which has front-panel switches!), so long as they work.
How they come into existence is completely outside the standard.
-- 
"Where is D.D. Harriman now,   |     Henry Spencer at U of Toronto Zoology
when we really *need* him?"    | uunet!attcan!utzoo!henry henry@zoo.toronto.edu