comp.lang.ada
 help / color / mirror / Atom feed
* dynamic loading and Ada95
@ 1997-10-27  0:00 Louis-Dominique Dubeau
  1997-10-28  0:00 ` Tucker Taft
  0 siblings, 1 reply; 4+ messages in thread
From: Louis-Dominique Dubeau @ 1997-10-27  0:00 UTC (permalink / raw)




Hello,

I'm looking for implementations of dynamic loading for Ada95.  I made
an implementation of dynamic loading for Modula-3 and wish to compare.
The problematic in both cases should be similar in at least two points:

- how to integrate package information after a dynamic load
- how to integrate tagged type information after a dynamic load and update
  the tagged types tree

	Thanks,
	ldd




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

* Re: dynamic loading and Ada95
  1997-10-27  0:00 dynamic loading and Ada95 Louis-Dominique Dubeau
@ 1997-10-28  0:00 ` Tucker Taft
  1997-10-29  0:00   ` Louis-Dominique Dubeau
  0 siblings, 1 reply; 4+ messages in thread
From: Tucker Taft @ 1997-10-28  0:00 UTC (permalink / raw)



Louis-Dominique Dubeau (ldd@step.polymtl.ca) wrote:

: I'm looking for implementations of dynamic loading for Ada95.  I made
: an implementation of dynamic loading for Modula-3 and wish to compare.

The AppletMagic(TM) Ada95 => Java byte code compiler uses
dynamic loading.

: The problematic in both cases should be similar in at least two points:

: - how to integrate package information after a dynamic load

Java has the notion of "class initialization" routines.  These
are executed after a class is loaded.  In our mapping, a package
spec and a package body each turn into a Java class, each with
its own class-init routine.  These are executed when the package
is loaded.

: - how to integrate tagged type information after a dynamic load and update
:   the tagged types tree

Our tagged type "tree" (used by Ada.Tags.Internal_Tag(String)) is
built up dynamically, as a result of "elaborating" the declaration
of a tagged type.  So dynamic loading does not cause a problem.

: 	Thanks,
: 	ldd

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




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

* Re: dynamic loading and Ada95
  1997-10-28  0:00 ` Tucker Taft
@ 1997-10-29  0:00   ` Louis-Dominique Dubeau
  1997-10-30  0:00     ` Tucker Taft
  0 siblings, 1 reply; 4+ messages in thread
From: Louis-Dominique Dubeau @ 1997-10-29  0:00 UTC (permalink / raw)



stt@houdini.camb.inmet.com (Tucker Taft) writes:

> Louis-Dominique Dubeau (ldd@step.polymtl.ca) wrote:
> 
> : I'm looking for implementations of dynamic loading for Ada95.  I made
> : an implementation of dynamic loading for Modula-3 and wish to compare.
> 
> The AppletMagic(TM) Ada95 => Java byte code compiler uses
> dynamic loading.

What implementation of Ada95 was used to build AppletMagic?

> : The problematic in both cases should be similar in at least two points:
> 
> : - how to integrate package information after a dynamic load
> 
> Java has the notion of "class initialization" routines.  These
> are executed after a class is loaded.  In our mapping, a package
> spec and a package body each turn into a Java class, each with
> its own class-init routine.  These are executed when the package
> is loaded.

You're outside the scope of my question.  I want to know if a core
program written in Ada95 is able to load a shared objet written in
Ada95 and then use it or if it will break.

This is implementation dependent.  I believe in GNAT you'd have a
problem.  Here is how a GNAT compiled program starts:

- main is called
- it calls the elaboration routines of bodies and specs.
- then calls the main function/procedure of the program

The elaboration routines are responsible to build type information for
the types they implement.  If you use dlopen() (for the ELF case) and
dlsym() to load a package and get the entry point to a function that
uses a type defined in that package, you're going to see fireworks.
The elaboration procedure of the package was never called (libdl
doesn't know about Ada) and thus the type doesn't exist.

The fix would be to have an Ada library do the work of loading the
package and then ensuring that the elaboration procedure is called,
etc.

	Regards,
	ldd




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

* Re: dynamic loading and Ada95
  1997-10-29  0:00   ` Louis-Dominique Dubeau
@ 1997-10-30  0:00     ` Tucker Taft
  0 siblings, 0 replies; 4+ messages in thread
From: Tucker Taft @ 1997-10-30  0:00 UTC (permalink / raw)



Louis-Dominique Dubeau (ldd@step.polymtl.ca) wrote:

: stt@houdini.camb.inmet.com (Tucker Taft) writes:

: > Louis-Dominique Dubeau (ldd@step.polymtl.ca) wrote:
: > 
: > : I'm looking for implementations of dynamic loading for Ada95.  I made
: > : an implementation of dynamic loading for Modula-3 and wish to compare.
: > 
: > The AppletMagic(TM) Ada95 => Java byte code compiler uses
: > dynamic loading.

: What implementation of Ada95 was used to build AppletMagic?

The Intermetrics AdaMagic front end, which is the same one used
inside Aonix and Green Hills Ada 95 compilers.

In any case, based on reading further, I realize you are talking
about using DLLs in Ada.  I was thinking of something even
more dynamic than that.  The Aonix Ada 95 product fully
supports building DLLs using Ada.  You should request their
documentation (cf www.aonix.com) if you want to know the
approach used.  It handles elaboration correctly, I believe.

: 	Regards,
: 	ldd

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA




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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-27  0:00 dynamic loading and Ada95 Louis-Dominique Dubeau
1997-10-28  0:00 ` Tucker Taft
1997-10-29  0:00   ` Louis-Dominique Dubeau
1997-10-30  0:00     ` Tucker Taft

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