comp.lang.ada
 help / color / mirror / Atom feed
From: sk <sk@noname.com>
Subject: Re: Link C main with Ada static library
Date: Fri, 29 Nov 2002 17:25:09 -0600
Date: 2002-11-29T17:25:09-06:00	[thread overview]
Message-ID: <mailman.1038612602.15983.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: fe4bb2c2.0211291427.4f2f6f1a@posting.google.com

Hi,

jeff.huter@bigfoot.com :
 > I have been unable to get it work using -L switch of
 > gnatbind as outlined in the manual

I have lost my 3.14p docs and have only just installed 3.15p,
but it seems that the gnatbind "-L" switch is new (undoubtdly
wrong, but I hadn't noticed "-L" for gnstbind before).

... but (following from previous example) ...

-- main.c
extern int return_forty_two ();
extern int mylibinit ();
extern int mylibfinal ();

#include <stdio.h>

int main () {

     int i = 0;

     printf ("i => %d\n", i);

     mylibinit ();

     i = return_forty_two ();

     mylibfinal ();

     printf ("i => %d\n", i);

};

... the build ...

# gnatmake static_ada_library
# gnatbind -Lmylib static_ada_library
# gcc -c b~static_ada_library.adb
# ar cr libmylib.a b~static_ada_library.o static_ada_library.o
# gcc main.c -o c-test -lmylib -L. \
usr/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/adalib/libgnat.a
# ./c-test
i => 0
i => 42
#


-- For real address, merge vertically
-------------------
-- s n p @ t . o
--  k i e k c c m
-------------------




      reply	other threads:[~2002-11-29 23:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-29  8:45 Link C main with Ada static library Jeff
2002-11-29 10:04 ` sk
2002-11-29 22:27   ` Jeff
2002-11-29 23:25     ` sk [this message]
replies disabled

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