comp.lang.ada
 help / color / mirror / Atom feed
* newbie: Problem with calling functions in shared library
@ 2001-03-19 11:00 Fokker Space
  2001-03-19 12:48 ` David C. Hoos, Sr.
  2001-03-21 18:28 ` Stephen Leake
  0 siblings, 2 replies; 3+ messages in thread
From: Fokker Space @ 2001-03-19 11:00 UTC (permalink / raw)


I have a question regarding Ada and libraries with the use of GNAT. We have
the following situation under operating system IRIX:

1) Ada source without main routine -> compile with gnatmake or gcc -> Get a
<name>.o file
2) Link the <name>.o file to a shared library <name>.so with the use of
gnatlink
3) An exe (from a C-source) loads the shared library with the
dlopen-function.
4) The exe determines the places of procedures and functions in the shared
library with the dlsym-function and calls them.

The problem is that I keep getting crashes when calling the functions in
the shared library. When I compile the same Ada source with the C-source
into a seperate exe the problem doesn't occur. I suspect I am compiling or
linking the shared library with the wrong flags or something like that.

Does anybody know what to do it this situation or (even better) have a
small example of a working program?

Bart Schipperijn



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

* Re: newbie: Problem with calling functions in shared library
  2001-03-19 11:00 newbie: Problem with calling functions in shared library Fokker Space
@ 2001-03-19 12:48 ` David C. Hoos, Sr.
  2001-03-21 18:28 ` Stephen Leake
  1 sibling, 0 replies; 3+ messages in thread
From: David C. Hoos, Sr. @ 2001-03-19 12:48 UTC (permalink / raw)


This sounds like there is elaboration code in the Ada shared library unit
that is not
getting called before the subprograms in the library.

There may be a symbol like _<unit-name>___elabb and/or _<unit-name>___elabs,
that need to be called before calling any of the subprograms in the library.


"Fokker Space" <F.Space@fokkerspace.nl> wrote in message
news:01c0b063$c08079b0$668e4991@pc1944...
> I have a question regarding Ada and libraries with the use of GNAT. We
have
> the following situation under operating system IRIX:
>
> 1) Ada source without main routine -> compile with gnatmake or gcc -> Get
a
> <name>.o file
> 2) Link the <name>.o file to a shared library <name>.so with the use of
> gnatlink
> 3) An exe (from a C-source) loads the shared library with the
> dlopen-function.
> 4) The exe determines the places of procedures and functions in the shared
> library with the dlsym-function and calls them.
>
> The problem is that I keep getting crashes when calling the functions in
> the shared library. When I compile the same Ada source with the C-source
> into a seperate exe the problem doesn't occur. I suspect I am compiling or
> linking the shared library with the wrong flags or something like that.
>
> Does anybody know what to do it this situation or (even better) have a
> small example of a working program?
>
> Bart Schipperijn




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

* Re: newbie: Problem with calling functions in shared library
  2001-03-19 11:00 newbie: Problem with calling functions in shared library Fokker Space
  2001-03-19 12:48 ` David C. Hoos, Sr.
@ 2001-03-21 18:28 ` Stephen Leake
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 2001-03-21 18:28 UTC (permalink / raw)


"Fokker Space" <F.Space@fokkerspace.nl> writes:

> I have a question regarding Ada and libraries with the use of GNAT. We have
> the following situation under operating system IRIX:
> 
> 1) Ada source without main routine -> compile with gnatmake or gcc -> Get a
> <name>.o file
> 2) Link the <name>.o file to a shared library <name>.so with the use of
> gnatlink
> 3) An exe (from a C-source) loads the shared library with the
> dlopen-function.
> 4) The exe determines the places of procedures and functions in the shared
> library with the dlsym-function and calls them.
> 
> The problem is that I keep getting crashes when calling the functions in
> the shared library. When I compile the same Ada source with the C-source
> into a seperate exe the problem doesn't occur. I suspect I am compiling or
> linking the shared library with the wrong flags or something like that.
> 
> Does anybody know what to do it this situation 

Do you call adainit and adafinal? Read the GNAT manual section on Ada
code with non-Ada main.

> or (even better) have a small example of a working program?

Only on Windows NT.

> 
> 
> Bart Schipperijn

-- 
-- Stephe



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

end of thread, other threads:[~2001-03-21 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-19 11:00 newbie: Problem with calling functions in shared library Fokker Space
2001-03-19 12:48 ` David C. Hoos, Sr.
2001-03-21 18:28 ` Stephen Leake

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