comp.lang.ada
 help / color / mirror / Atom feed
* Re: [Fwd: Compile with C code...]
  2000-10-19  0:00 [Fwd: Compile with C code...] Alejandro Villanueva
@ 2000-10-19  0:00 ` Robert Dewar
  2000-10-19  0:00   ` Alejandro Villanueva
  0 siblings, 1 reply; 6+ messages in thread
From: Robert Dewar @ 2000-10-19  0:00 UTC (permalink / raw)


In article <39EEF80B.1242805C@cepsz.unizar.es>,
  Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> I'm not sure if this is a good place to ask this but: how do I
call an
> Ada procedure from a C main program using GNAT 3.11p
>
> I followed the user's guide instructions but didn't work !!
>
> These are my files attached.
>
> Thanks!

Mostly this is an implementation independent issue, look up
the use of the pragma Export in your Ada book ...

Trying to use the internal GNAT stuff is wrong, and you
need to know too much to do this. The documentation in the
users guide is assuming that you use pragma Export, since
of course this is required by the Ada 95 language in this case

Also, why use such an out of date version of GNAT?


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* [Fwd: Compile with C code...]
@ 2000-10-19  0:00 Alejandro Villanueva
  2000-10-19  0:00 ` Robert Dewar
  0 siblings, 1 reply; 6+ messages in thread
From: Alejandro Villanueva @ 2000-10-19  0:00 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 314 bytes --]



--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------



[-- Attachment #2: Type: message/rfc822, Size: 2162 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 550 bytes --]

Hi you all,

I'm not sure if this is a good place to ask this but: how do I call an
Ada procedure from a C main program using GNAT 3.11p

I followed the user's guide instructions but didn't work !!

These are my files attached.

Thanks!

--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------



[-- Attachment #2.1.2: hola.adb --]
[-- Type: text/plain, Size: 85 bytes --]

with Text_IO; use Text_IO;
procedure Hola is
begin
   Put_Line ("Hola!");
end Hola;


[-- Attachment #2.1.3: hola.ads --]
[-- Type: text/plain, Size: 54 bytes --]

procedure Hola;
pragma Export (C, Hola, "ada_hola");


[-- Attachment #2.1.4: main.c --]
[-- Type: text/plain, Size: 65 bytes --]

void main(void) {
   adainit();
   ada_hola();
   adafinal();
}


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

* Re: [Fwd: Compile with C code...]
  2000-10-19  0:00 ` Robert Dewar
@ 2000-10-19  0:00   ` Alejandro Villanueva
  2000-10-19  0:00     ` Pascal Obry
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alejandro Villanueva @ 2000-10-19  0:00 UTC (permalink / raw)


Robert Dewar wrote:

> In article <39EEF80B.1242805C@cepsz.unizar.es>,
>   Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> > I'm not sure if this is a good place to ask this but: how do I
> call an
> > Ada procedure from a C main program using GNAT 3.11p
> >
> > I followed the user's guide instructions but didn't work !!
> >
> > These are my files attached.
> >
> > Thanks!
>
> Mostly this is an implementation independent issue, look up
> the use of the pragma Export in your Ada book ...
>
> Trying to use the internal GNAT stuff is wrong, and you
> need to know too much to do this. The documentation in the
> users guide is assuming that you use pragma Export, since
> of course this is required by the Ada 95 language in this case
>
> Also, why use such an out of date version of GNAT?
>

Well, these are the steps I perform:
gcc -c hola.adb
gnatbind -x hola.ali
gcc main.c b_hola.o hola.o

I really think this is correct, but I get some interesting error
messages about undefined symbols...

Of course I use pragme Export (correctly, for sure).

The reason I use 3.11p is because I'm working with GNAT/RTEMS to produce
an embedded system. The RTEMS operating system only uses 3.11p at this
momment :-(

Do you think the above compilation chain is incorrect? I think I'm
missing something but I don't know what could it be...

Thanks again,

Alejandro.

>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------







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

* Re: [Fwd: Compile with C code...]
  2000-10-19  0:00   ` Alejandro Villanueva
  2000-10-19  0:00     ` Pascal Obry
@ 2000-10-19  0:00     ` David C. Hoos, Sr.
  2000-10-20  0:00     ` Joel Sherrill
  2 siblings, 0 replies; 6+ messages in thread
From: David C. Hoos, Sr. @ 2000-10-19  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]

There is a small example on my FTP site that shows how to do this.
URL: ftp://ftp.ada95.com/pub/ada_from_c_main.tgz
or
URL: ftp://ftp.ada95.com/pub/ada_from_c_main.tar.gz



"Alejandro Villanueva" <190921@cepsz.unizar.es> wrote in message
news:39EF0DB2.35CED1C5@cepsz.unizar.es...
> Robert Dewar wrote:
>
> > In article <39EEF80B.1242805C@cepsz.unizar.es>,
> >   Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> > > I'm not sure if this is a good place to ask this but: how do I
> > call an
> > > Ada procedure from a C main program using GNAT 3.11p
> > >
> > > I followed the user's guide instructions but didn't work !!
> > >
> > > These are my files attached.
> > >
> > > Thanks!
> >
> > Mostly this is an implementation independent issue, look up
> > the use of the pragma Export in your Ada book ...
> >
> > Trying to use the internal GNAT stuff is wrong, and you
> > need to know too much to do this. The documentation in the
> > users guide is assuming that you use pragma Export, since
> > of course this is required by the Ada 95 language in this case
> >
> > Also, why use such an out of date version of GNAT?
> >
>
> Well, these are the steps I perform:
> gcc -c hola.adb
> gnatbind -x hola.ali
> gcc main.c b_hola.o hola.o
>
> I really think this is correct, but I get some interesting error
> messages about undefined symbols...
>
> Of course I use pragme Export (correctly, for sure).
>
> The reason I use 3.11p is because I'm working with GNAT/RTEMS to produce
> an embedded system. The RTEMS operating system only uses 3.11p at this
> momment :-(
>
> Do you think the above compilation chain is incorrect? I think I'm
> missing something but I don't know what could it be...
>
> Thanks again,
>
> Alejandro.
>
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> --
> ------------------------------------------------------
> �Quieres Cobrar por Navegar en Internet?
> Visita: http://www.navegana.com/dinero/flintstone.html
> ------------------------------------------------------
> Alejandro Villanueva
> 190921@cepsz.unizar.es
> ------------------------------------------------------
>
>
>








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

* Re: [Fwd: Compile with C code...]
  2000-10-19  0:00   ` Alejandro Villanueva
@ 2000-10-19  0:00     ` Pascal Obry
  2000-10-19  0:00     ` David C. Hoos, Sr.
  2000-10-20  0:00     ` Joel Sherrill
  2 siblings, 0 replies; 6+ messages in thread
From: Pascal Obry @ 2000-10-19  0:00 UTC (permalink / raw)



Alejandro Villanueva <190921@cepsz.unizar.es> writes:

> Well, these are the steps I perform:
> gcc -c hola.adb
> gnatbind -x hola.ali
> gcc main.c b_hola.o hola.o

This can't work. You try to build an executable containing Ada code without
the GNAT runtime :) :)

Try something like:
   $ gcc -c main.c
   $ gnatmake hola -largs main.o

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"




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

* Re: [Fwd: Compile with C code...]
  2000-10-19  0:00   ` Alejandro Villanueva
  2000-10-19  0:00     ` Pascal Obry
  2000-10-19  0:00     ` David C. Hoos, Sr.
@ 2000-10-20  0:00     ` Joel Sherrill
  2 siblings, 0 replies; 6+ messages in thread
From: Joel Sherrill @ 2000-10-20  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2467 bytes --]

In article <39EF0DB2.35CED1C5@cepsz.unizar.es>,
  Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> Robert Dewar wrote:
>
> > In article <39EEF80B.1242805C@cepsz.unizar.es>,
> >   Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> > > I'm not sure if this is a good place to ask this but: how do I
> > call an
> > > Ada procedure from a C main program using GNAT 3.11p
> > >
> > > I followed the user's guide instructions but didn't work !!
> > >
> > > These are my files attached.
> > >
> > > Thanks!
> >
> > Mostly this is an implementation independent issue, look up
> > the use of the pragma Export in your Ada book ...
> >
> > Trying to use the internal GNAT stuff is wrong, and you
> > need to know too much to do this. The documentation in the
> > users guide is assuming that you use pragma Export, since
> > of course this is required by the Ada 95 language in this case
> >
> > Also, why use such an out of date version of GNAT?
> >
>
> Well, these are the steps I perform:
> gcc -c hola.adb
> gnatbind -x hola.ali
> gcc main.c b_hola.o hola.o
>
> I really think this is correct, but I get some interesting error
> messages about undefined symbols...
>
> Of course I use pragme Export (correctly, for sure).
> > The reason I use 3.11p is because I'm working with GNAT/RTEMS to
produce
> an embedded system. The RTEMS operating system only uses 3.11p at this
> momment :-(

Hmm.. I don't think so.  3.12p patches and RPMs have been available
for months.  They were available soon after the 3.12p release.  The
newest date on any RTEMS patch to 3.12p is back in April.

3.13p patches and RPMs were made available in September. That is about
a month after it was released. It was announced on both gnat-list
and rtems-users.

> Thanks again,
>
> Alejandro.
>
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
> --
> ------------------------------------------------------
> �Quieres Cobrar por Navegar en Internet?
> Visita: http://www.navegana.com/dinero/flintstone.html
> ------------------------------------------------------
> Alejandro Villanueva
> 190921@cepsz.unizar.es
> ------------------------------------------------------
>
--
Joel Sherrill, Ph.D.             Director of Research & Development
joel@OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985


Sent via Deja.com http://www.deja.com/
Before you buy.




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

end of thread, other threads:[~2000-10-20  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-19  0:00 [Fwd: Compile with C code...] Alejandro Villanueva
2000-10-19  0:00 ` Robert Dewar
2000-10-19  0:00   ` Alejandro Villanueva
2000-10-19  0:00     ` Pascal Obry
2000-10-19  0:00     ` David C. Hoos, Sr.
2000-10-20  0:00     ` Joel Sherrill

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