comp.lang.ada
 help / color / mirror / Atom feed
From: harvey@blkbox.COM (Greg Harvey)
Subject: Re: Calling C++ from within ADA
Date: 4 Nov 1994 11:31:41 -0600
Date: 1994-11-04T11:31:41-06:00	[thread overview]
Message-ID: <39dr5t$lm9@blkbox.blkbox.COM> (raw)
In-Reply-To: CypvDM.8q5@nntpa.cb.att.com

ka@socrates.hr.att.com (Kenneth Almquist) writes:

>CVANOVER@bamanet.ua.edu wrote:
>> Is there a way to call a C++ procedure from within ADA?  I can call a C 
>> procedure with 
>>
>> package C_LIB is
>>         procedure clear_screen;
>>         procedure sleep_a_moment;
>> private
>>         pragma interface(c,clear_screen);
>>         pragma interface(c,sleep_a_moment);
>> end C_LIB;
>>
>> However, when I compile the same C procedure in C++ [things don't work].

>Change the interface pragmas to tell the Ada compiler that the
>procedures are C++ procedures rather than C procedures.  If you can't
>do this becuase your Ada compiler doesn't know about C++, add the
>following to your C++ code:

>extern "C" void clear_screen(void);
>extern "C" void sleep_a_moment(void);

>This will tell the C++ compiler to use C calling conventions for these
>procedures.
>					Kenneth Almquist

Isn't this where the people who like to complain about object-based languages
with no static binding start showing up?

;)

Greg Harvey (harvey@blkbox.com)



  parent reply	other threads:[~1994-11-04 17:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-03 12:53 Calling C++ from within ADA CVANOVER
1994-11-03 15:11 ` Norman H. Cohen
     [not found] ` <CypvDM.8q5@nntpa.cb.att.com>
1994-11-04 17:31   ` Greg Harvey [this message]
1994-11-04 17:46     ` Greg Harvey
1994-11-07  2:52 ` Oliver E. Cole
1994-11-08 15:22 ` Eric Beser
1994-11-08 18:34 ` Richard G. Hash
replies disabled

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