comp.lang.ada
 help / color / mirror / Atom feed
* Linking to c++ libraries problem
@ 1998-08-18  0:00 Mark
  1998-08-18  0:00 ` Jerry van Dijk
  0 siblings, 1 reply; 4+ messages in thread
From: Mark @ 1998-08-18  0:00 UTC (permalink / raw)


I am using the Gnat ada compiler to link an ada program with functions
defined in c++ . libraries (Microsoft Visual c++ v5).
The problem I am having is that the c++ libraries make use of C++ library
functions (like printf) and when I link using the Gnat ada compiler I get
undefined references to a host of things (like _imp__fprintf). 
The command line I am using is 
	gnatlink main.adb <list of provided c++ libraries>
I think that I want to add to this a library to resolve the missing
declarations but I am not sure what the library is.

Is this library available within gnat?

If not can I use a library within Microsoft Visual c++ v5, if so which

Any response via news group please.




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

* Re: Linking to c++ libraries problem
  1998-08-18  0:00 Linking to c++ libraries problem Mark
@ 1998-08-18  0:00 ` Jerry van Dijk
  1998-08-19  0:00   ` Mark
  0 siblings, 1 reply; 4+ messages in thread
From: Jerry van Dijk @ 1998-08-18  0:00 UTC (permalink / raw)


Mark (wilson_m_r@yahoo.com) wrote:

: I am using the Gnat ada compiler to link an ada program with functions
: defined in c++ . libraries (Microsoft Visual c++ v5).

Ok. Assuming you are using 3.10p.

: The problem I am having is that the c++ libraries make use of C++ library
: functions (like printf)

Actually, printf is a C library function, in C++ you would use the 
cout stream.

: and when I link using the Gnat ada compiler I get
: undefined references to a host of things (like _imp__fprintf). 

: I think that I want to add to this a library to resolve the missing
: declarations but I am not sure what the library is.

: Is this library available within gnat?

Since you are calling a C library function, it tries to link to the 
MS C runtime DLL import library. GNAT links in the gcc style import
library to this dll, which has a different format, so, the function
is not found.

The easiest way out is to recompile your C or C++ code using gcc.
(if it is C code, the C compiler is included with gnat). If that is
not possible, recompile the C++ code as a dll and import this through
a package. See my homepage: http://stad.dsl.nl/~jvandyk for more info.

Jerry.


-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




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

* Re: Linking to c++ libraries problem
  1998-08-18  0:00 ` Jerry van Dijk
@ 1998-08-19  0:00   ` Mark
  1998-08-19  0:00     ` Jerry van Dijk
  0 siblings, 1 reply; 4+ messages in thread
From: Mark @ 1998-08-19  0:00 UTC (permalink / raw)




Jerry van Dijk <jerry@jvdsys.nextjk.stuyts.nl> wrote in article
<ExwJqp.B4@jvdsys.nextjk.stuyts.nl>...
> Mark (wilson_m_r@yahoo.com) wrote:
> 
> : I am using the Gnat ada compiler to link an ada program with functions
> : defined in c++ . libraries (Microsoft Visual c++ v5).
> 
> Ok. Assuming you are using 3.10p.

	Correct.

> 
> : The problem I am having is that the c++ libraries make use of C++
library
> : functions (like printf)
> 
> Actually, printf is a C library function, in C++ you would use the 
> cout stream.
>

 	I am using libraries that have been created using Microsoft Visual c++ v5
which I presume has an c compiler built in.

> : and when I link using the Gnat ada compiler I get
> : undefined references to a host of things (like _imp__fprintf). 
> 
> : I think that I want to add to this a library to resolve the missing
> : declarations but I am not sure what the library is.
> 
> : Is this library available within gnat?
> 
> Since you are calling a C library function
 	
	I am calling a c function that has been resolved by the list of provided
libraries, the    library functions that I'm calling then make use of
standard c functions like printf.


>                                                            , it tries to
link to the 
> MS C runtime DLL import library. GNAT links in the gcc style import
> library to this dll, which has a different format, so, the function
> is not found.
> 
> The easiest way out is to recompile your C or C++ code using gcc.

	I do not have the source, only the ".lib" files.

> (if it is C code, the C compiler is included with gnat). If that is
> not possible, recompile the C++ code as a dll and import this through
> a package. See my homepage: http://stad.dsl.nl/~jvandyk for more info.

	At present I'm asking the supplier of the libraries to provide me with the
dlls. 
	
	Has this not already been done before for the standard c and c++
libraries?

     Thanks for the help 
	Mark


	Whats for you wont go by you! 




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

* Re: Linking to c++ libraries problem
  1998-08-19  0:00   ` Mark
@ 1998-08-19  0:00     ` Jerry van Dijk
  0 siblings, 0 replies; 4+ messages in thread
From: Jerry van Dijk @ 1998-08-19  0:00 UTC (permalink / raw)


Mark (wilson_m_r@yahoo.com) wrote:

: 	Has this not already been done before for the standard c and c++
: libraries?

As I said, the import library to the C runtime DLL comes with GNAT
(default: /usr/lib/libcrtdll.a), but it's format is different.

Hopefully GNAT 3.11p for NT will support the native file formats.

Jerry.
-- 
-- Jerry van Dijk  | email: jdijk@acm.org
-- Leiden, Holland | member Team-Ada
-- Ada & Win32: http://stad.dsl.nl/~jvandyk




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

end of thread, other threads:[~1998-08-19  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-18  0:00 Linking to c++ libraries problem Mark
1998-08-18  0:00 ` Jerry van Dijk
1998-08-19  0:00   ` Mark
1998-08-19  0:00     ` Jerry van Dijk

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