comp.lang.ada
 help / color / mirror / Atom feed
From: 459143320@att.net@worldnet.att.net (anon)
Subject: Re: ada import c function
Date: Tue, 28 Apr 2009 23:08:35 GMT
Date: 2009-04-28T23:08:35+00:00	[thread overview]
Message-ID: <T%LJl.174457$4m1.123708@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: 6568256f-39cd-4757-a630-fe6e4a9a82fc@l16g2000pra.googlegroups.com

there are basically two ways 

gcc -c imported_function.c -o imported_function.o
gnat make use_of_import.adb 
gnat bind use_of_import.ali
gnat link use_of_import.ali imported_function.o

or the quick way 

gcc -c imported_function.c -o imported_function.o
gnat make use_of_import.adb -largs imported_function.o




In <6568256f-39cd-4757-a630-fe6e4a9a82fc@l16g2000pra.googlegroups.com>, "s. ashen" <spain.ashen@gmail.com> writes:
>Does anyone import C function to ada??
>Using gnat 3.15, i try to compile the example which contain two files
>  use_of_import.adb
>
>procedure Use_Of_Import is
>   procedure Imported_Function;
>   pragma Import (C, Imported_Function, "imported_function");
>begin
>   Imported_Function;
>end Use_Of_Import;
>
>  imported_function.c
>
>#include <stdio.h>
>imported_function ()
>{
>  printf ("\nI am now in the imported function\n\n");
>}
>
>does anyone know how to compile this program, i had tried many in many
>ways, but i can't do this.. always occurred some  errors.




  parent reply	other threads:[~2009-04-28 23:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 20:45 ada import c function s. ashen
2009-04-28 21:18 ` Maciej Sobczak
2009-04-28 21:40 ` sjw
2009-04-28 23:08 ` 459143320 [this message]
2009-04-29 16:00   ` s. ashen
2009-04-29 19:03   ` sjw
2009-04-29 23:04     ` anon
2009-04-30 20:48       ` sjw
2009-04-30 21:32         ` Gautier
2009-04-30 23:42           ` linking with g++ (was: ada import c function) Björn Persson
2009-05-01  5:48             ` linking with g++ Gautier
replies disabled

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