comp.lang.ada
 help / color / mirror / Atom feed
* Interface between ADA and C++
@ 1996-05-22  0:00 Norbert Roeben
  1996-05-23  0:00 ` Kevin F. Quinn
  1996-05-24  0:00 ` Vincent P. Amiot
  0 siblings, 2 replies; 7+ messages in thread
From: Norbert Roeben @ 1996-05-22  0:00 UTC (permalink / 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  |
+------------------------------------------------------------------------+




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

end of thread, other threads:[~1996-05-29  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-22  0:00 Interface between ADA and C++ Norbert Roeben
1996-05-23  0:00 ` 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

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