comp.lang.ada
 help / color / mirror / Atom feed
From: Norbert Roeben <roeben@essiris2.atlas.de>
Subject: Interface between ADA and C++
Date: 1996/05/22
Date: 1996-05-22T00:00:00+00:00	[thread overview]
Message-ID: <31A2C469.41C6@essiris2.atlas.de> (raw)


Hi,

I'm trying to find a way to interface ADA with C++. 
I'm using GNAT 3.03 with gcc 2.7.2 with g++ library 2.7.1.

I try to call an C++ function from Ada. The linker always searches for
C - function, not for a C++ - function.

Does anybody has a solution for this ?

Here an extract from my sources and the way I compiled them :

ADA Sources :

file hellointerface.ads :

	package HelloInterface is

	   procedure CppHello          ( Text    : String  );

	  private

	  -- Interface to a C++ - function
	  pragma Import       ( Cpp,CppHello,"CppHello");

	end HelloInterface;


file hello.adb :

	with text_io;
	with HelloInterface;

	procedure Hello is

	begin
   
	   HelloInterface.CppHello ("And it works with C++");

	end;



C++ Source :

file cppHello.cc :

	#include <iostream.h>

	void CppHello ( char *String ) {

	  cout << String << endl;

	}


The way how I compiled them:

gcc -g -c hello.adb
gcc -g -c hellointerface.ads
g++ -g -c cppHello.c
gnatbl hello.ali -o hello cppHello.o cHello.o -lg++ -lstdc++

The Error Message I got :

	No code generated for file hellointerface.ads (package spec)
	No code generated for file except.ads (package spec)
	collect2: ld returned 1 exit status
	/usr/bin/../lib/ld:
	Unresolved:
	CppHello



-- 
+-----------------+----------------------+-------------------------------+
| Norbert Roeben  | DEPARTMENT :  ETS 52 |  PHONE : (49) 421-4573695     |
+-----------------+----------------------+-------------------------------+
| EMAIL  : roeben@essiris2.atlas.de                                      |
+------------------------------------------------------------------------+
| STN ATLAS Elektronik            Brueggeweg 54            28305 Bremen  |
+------------------------------------------------------------------------+




             reply	other threads:[~1996-05-22  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-05-22  0:00 Norbert Roeben [this message]
1996-05-23  0:00 ` Interface between ADA and C++ Kevin F. Quinn
1996-05-23  0:00   ` Mike Young
1996-05-24  0:00     ` Darren C Davenport
1996-05-29  0:00       ` Ken Slater
1996-05-29  0:00         ` Ding-yuan Sheu
1996-05-24  0:00 ` Vincent P. Amiot
replies disabled

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