comp.lang.ada
 help / color / mirror / Atom feed
* linking with C++
@ 1998-04-20  0:00 Martin Klang
  1998-04-21  0:00 ` Robert Dewar
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Martin Klang @ 1998-04-20  0:00 UTC (permalink / raw)



lately i've been trying out ADA, and even though it's not by a long way as
esthetically pleasing as C++, i must confess it's a pretty useful little
language.

my problem (one of many, though the only one i'll cumber you with):

i cannot link to C++ with gnatlink.

even compiling the exact same code with g++ instead of gcc will produce an 
error with gnatlink, which claims the referenced function is undefined.

this is what happens:

//file cstuff.c
#include <stdio.h>
void c_test()
{
  printf("jah!");
}
//file cstuff.c

which i compile with:
>gcc -c cstuff.c -o c.o
>g++ -c cstuff.c -o cc.o

//file test.adb
procedure Test is
   procedure C_Test;
   pragma Import(CPP,C_Test,"c_test");
begin
   C_Test;
end Tester;        
//file test.adb

now, if i do:
>gnatmake test -largs c.o
it works, but if i do:
>gnatmake test -largs cc.o
it fails to link.

it seems to have no importance in this example whether i use pragma C or CPP
(what is the difference anyhow?)

comparing c.o and cc.o yields that g++ somewhere along the line renamned the
c_test-function to c_test__Fv. Why???

any help much appreciated,
martin


  "Disobedience is the true foundation of liberty.
   The obedient must be slaves."

--Henry David Thoreau, 1847




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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-20  0:00 linking with C++ Martin Klang
1998-04-21  0:00 ` Robert Dewar
1998-04-23  0:00   ` [GNAT] Extending a C++ class Jacob Sparre Andersen
1998-04-21  0:00 ` linking with C++ Jerry van Dijk
1998-04-21  0:00 ` Robert Dewar
1998-04-21  0:00 ` Justin Braach

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