comp.lang.ada
 help / color / mirror / Atom feed
* Package Interface, and interoperbility
@ 1994-09-23 15:53 WOODRUFF
  1994-09-24 10:44 ` Stephen J Bevan
  1994-09-24 21:05 ` Bob Duff
  0 siblings, 2 replies; 3+ messages in thread
From: WOODRUFF @ 1994-09-23 15:53 UTC (permalink / raw)


I have been studying the package Interface and I am puzzled about how
Ada implementations will be able to interface with other languages in
one specific situation.  I'm probably overlooking some important feature
so I hope somebody will enlighten me.

I learn in Interface.C.Pointer that I can instantiate that package and
then I will have a type Pointer that will let me link a C library that
has data of type Element * on its interface.  

My concern is that this appears to assume that *every* C implementation
uses the same representation for Element *.   Otherwise I think some
C-compiled library will not be callable from my Ada program because the
C compiler used a representation for Element * that disagrees with the
Ada compiler's code.  What's worse, one library will be fine and another
(compiled with a different C compiler) will be unusable, and I won't
know before I spend MY OWN MONEY (tm) on the library that I'm in
trouble. 

Is there reason for concern here? 

John



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Package Interface, and interoperbility
  1994-09-23 15:53 Package Interface, and interoperbility WOODRUFF
@ 1994-09-24 10:44 ` Stephen J Bevan
  1994-09-24 21:05 ` Bob Duff
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen J Bevan @ 1994-09-24 10:44 UTC (permalink / raw)


In article <WOODRUFF.94Sep23155316@ec2226.addvax.llnl.gov> WOODRUFF@ec2226.addvax.llnl.gov writes:
   ... My concern is that this appears to assume that *every* C implementation
   uses the same representation for Element *.   Otherwise I think some
   C-compiled library will not be callable from my Ada program because the
   C compiler used a representation for Element * that disagrees with the
   Ada compiler's code.  What's worse, one library will be fine and another
   (compiled with a different C compiler) will be unusable, and I won't
   know before I spend MY OWN MONEY (tm) on the library that I'm in
   trouble. 

The problem you describe is possible, but doesn't seem to happen in
practice.  "the market" appears to have ensured that every
(commercial) C implementation (on a given platform) does use the same
representation.  If the compiler didn't, it wouldn't be able to link
against third party libraries and hence people probably wouldn't buy
the compiler unless there was a great incentive to do so.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Package Interface, and interoperbility
  1994-09-23 15:53 Package Interface, and interoperbility WOODRUFF
  1994-09-24 10:44 ` Stephen J Bevan
@ 1994-09-24 21:05 ` Bob Duff
  1 sibling, 0 replies; 3+ messages in thread
From: Bob Duff @ 1994-09-24 21:05 UTC (permalink / raw)


In article <WOODRUFF.94Sep23155316@ec2226.addvax.llnl.gov>,
 <WOODRUFF@ec2226.addvax.llnl.gov> wrote:
>I have been studying the package Interface and I am puzzled about how
>Ada implementations will be able to interface with other languages in
>one specific situation.  I'm probably overlooking some important feature
>so I hope somebody will enlighten me.

The idea is that implementations will provide various interfaces
specific to particular implementations (if necessary), such as
Interfaces.Microsoft_C, Interfaces.Borland_C, Interfaces.Some_Other_C.
Interfaces.C will just be an interface to the "default" C compiler:

    package Interfaces.C renames Interfaces.Whatever_C;

If you don't like the default, compile a different renames, or else
directly 'with' Interfaces.Your_Favorite_C.

In practice, most C compilers follow the same conventions, so the same
Interfaces.C might work for all C compilers -- if that's true, then the
Ada compiler will only need one Interfaces.C.  The above scenario is for
cases where the other language has different and incompatible compilers.
So you might see Interfaces.This_Lisp and Interfaces.That_Lisp.
-- 
Bob Duff                                bobduff@inmet.com
Oak Tree Software, Inc.
Ada 9X Mapping/Revision Team (Intermetrics, Inc.)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1994-09-24 21:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-09-23 15:53 Package Interface, and interoperbility WOODRUFF
1994-09-24 10:44 ` Stephen J Bevan
1994-09-24 21:05 ` Bob Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox