comp.lang.ada
 help / color / mirror / Atom feed
* calling an ada procedure from C++
@ 2003-11-12 15:11 Anthony Moss
  2003-11-17  4:04 ` red floyd
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Anthony Moss @ 2003-11-12 15:11 UTC (permalink / raw)


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







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

end of thread, other threads:[~2003-11-22  5:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-12 15:11 calling an ada procedure from C++ Anthony Moss
2003-11-17  4:04 ` red floyd
2003-11-17  7:37 ` tmoran
2003-11-17 10:38 ` Duncan Sands
2003-11-17 14:32   ` Hyman Rosen
2003-11-17 18:28     ` Frank J. Lhota
2003-11-18  0:03       ` Ludovic Brenta
2003-11-18  0:32         ` Frank J. Lhota
2003-11-22  5:25           ` Dave Thompson
2003-11-17 21:13 ` sk

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