gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Shared library support in Modula-2


From: Gaius Mulley
Subject: [Gm2] Shared library support in Modula-2
Date: 02 May 2008 21:08:50 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Hi,

As mentioned in a previous email, I think there are three main ISO
Modula-2 language features that remain to be implemented.  (Type
COMPLEX, multidimensional unbounded arrays and to finish exception
handling).

Coupled with exception handling is module initialisation and
finalisation - both straightforward - however they do lend themselves
to fit nicely with shared library support and map onto the shared
library constructor/destructor.  This raises the question of whether
to implement inter module procedure calls by using dlopen/dlsym.  In
effect a module could have an array of void *'s which are contain the
address of each and every external procedure call.  Initially each
array element could be directed to the default handler which looks up
the symbol name in the external shared library.  Once looked up the
address would be stored into the appropriate array element ready for
next time the procedure is called.  Of course a similar scheme would
need to be done for external variables.

Alternatively shared library support could just map the initialisation
and finalisation calls onto the same shared library
constructor/destructor.  Any inter procedure calls could be linked
using traditional `ld' calls.  Or put another way multiple modules
could be linked into a single shared library using `ld'.

I guess the advantage with the first method is that it would be
possible to compile every library as a shared library.  Finally
the user could run the runtime system followed by the main module
name and watch the application come to life via a series of
dynamic library loads.  Ie:

  m2 modulename

It might be quite nice from the perspective of IDEs, maybe.  Although
it would contain a slight performance cost.  My question is, whether
this is sensible or what users want?  Or do you want both :-)

regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]