From: md4mars@mdstud.chalmers.se (Martin Klang)
Subject: linking with C++
Date: 1998/04/20
Date: 1998-04-20T00:00:00+00:00 [thread overview]
Message-ID: <6hglkj$dlh$1@nyheter.chalmers.se> (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
next reply other threads:[~1998-04-20 0:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-04-20 0:00 Martin Klang [this message]
1998-04-21 0:00 ` linking with C++ 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 ` Justin Braach
1998-04-21 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox