Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: calling an ada procedure from C++

Reply
Thread Tools

Re: calling an ada procedure from C++

 
 
red floyd
Guest
Posts: n/a
 
      11-17-2003
Anthony Moss wrote:
> I have an ada simulation and a windows C++ graphics program already created.
> My task is to transfer the information from the ada written simulation to
> the VisualC++ graphics program. This involves transfering a large structure
> of information from ada to C++. To do this i have written a very small
> program to pass a simple structure from ada to C++, but I am getting run
> time access errors. I will place a copy of the code onto this message, so
> could you tell me what is wrong and how to fix it.
> thanks
> Anthony Moss
> The ada code is .....
> package Output is
>
> type Record_T is
> record
> First : Integer;
> Second : Integer;
> end record;
>
> --type Record_Ptr is access Record_T;
>
> function Struct return Record_T;
> pragma Export (C, Struct, "Struct");
>
> end Output;
>
> package body Output is
>
> function Struct return Record_T is
> A_Record : Record_T :=(2,4);
> begin
> return A_Record;
> end Struct;
>
> end Output;
>
>
> The C++ code is..
>
> typedef struct {
> int first;
> int second;
> } A_Struct;
>
> extern "C" {
> A_Struct Struct();
> }
>
> int main()
> {
> A_Struct A = Struct();
>
> __asm nop;
> return 0;
> }
>
> ps when iinclude adainit() and adafinal I am getting
> unresolved external symbol _adafinal.....
> errors
>
>
>
>


Cross language Ada is always tricky. What platform are you using (both C++ and
Ada compilers)?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded languages based on early Ada (from "Re: Preferred OS, processor family for running embedded Ada?") Colin Paul Gloster VHDL 48 04-10-2007 10:31 AM
Java facade to Ada code? kk_oop@yahoo.com Java 5 03-23-2006 02:17 PM
ANNOUNCE: XIA 1.00 (XPath In Ada) now available Marc A. Criley XML 0 03-11-2005 07:10 PM
Re: Ada performance (was No call for Ada ) Joona I Palaste Java 0 02-15-2004 07:17 PM
ADA/C++/IDL to XML? Ken XML 0 09-05-2003 12:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57