Re: calling an ada procedure from C++

Discussion in 'C++' started by red floyd, Nov 17, 2003.

  1. red floyd

    red floyd Guest

    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)?
    red floyd, Nov 17, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joona I Palaste

    Re: Ada performance (was No call for Ada )

    Joona I Palaste, Feb 15, 2004, in forum: Java
    Replies:
    0
    Views:
    442
    Joona I Palaste
    Feb 15, 2004
  2. Replies:
    5
    Views:
    594
    TechBookReport
    Mar 23, 2006
  3. Ken

    ADA/C++/IDL to XML?

    Ken, Sep 5, 2003, in forum: XML
    Replies:
    0
    Views:
    625
  4. Marc A. Criley
    Replies:
    0
    Views:
    351
    Marc A. Criley
    Mar 11, 2005
  5. Andy Glew
    Replies:
    84
    Views:
    1,843
    Dave Vandervies
    Oct 28, 2003
Loading...

Share This Page