* Re: zsh-3.1 development: dynamic modules
1996-11-06 21:38 zsh-3.1 development: dynamic modules Zoltan Hidvegi
@ 1996-11-07 16:05 ` Peter Stephenson
1996-11-07 17:31 ` Bart Schaefer
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 1996-11-07 16:05 UTC (permalink / raw)
To: Zsh hackers list
Zoltan Hidvegi wrote:
> I have stared working on binary module support in zsh. The preliminary
> version is almost usable. I tested it on ELF Linux SunOS and Solaris and
> it seems to work. Of course the most difficult part is to make it
> portable. I looked at the perl sources for that but I not yet added
> everything which is there.
Success on IRIX 5.3 (which is ELF) using gcc (haven't tried the native
compiler yet) with the following minor changes: (1) gcc didn't like
the hacked-up version of the prototype ANSIfier, it doesn't strip
enough parentheses (2) -shared was required on linking the example
module to prevent it trying to find `main' etc. I would suggest that
all ELF/gcc combinations use -shared; maybe it's always necessary with
gcc but I don't know how that interacts with ld in the general case.
I've also added what must be a missing $ before a GCC test a few lines
later. autoconf's not working here at the moment so I haven't
actually used the patched configure.in.
*** Src/mod_example.c.old Thu Nov 7 16:45:55 1996
--- Src/mod_example.c Thu Nov 7 16:39:28 1996
***************
*** 31,37 ****
#include <stdio.h>
! #define _(X) (X)
typedef int (*HandlerFunc) _((char *, char **, char *, int));
--- 31,37 ----
#include <stdio.h>
! #define _(X) X
typedef int (*HandlerFunc) _((char *, char **, char *, int));
*** configure.in.old Thu Nov 7 16:46:45 1996
--- configure.in Thu Nov 7 17:00:50 1996
***************
*** 666,675 ****
DL_EXT="${DL_EXT=so}"
if test $zsh_cv_sys_elf = yes; then
DLLD="${DLLD=$CC}"
else
DLLD="${DLLD=ld}"
fi
! if test -n "GCC"; then
DLCFLAGS="${DLCFLAGS=-fpic}"
else
case "$host_os" in
--- 666,678 ----
DL_EXT="${DL_EXT=so}"
if test $zsh_cv_sys_elf = yes; then
DLLD="${DLLD=$CC}"
+ if test -n "$GCC"; then
+ DLLDFLAGS="${DLLDFLAGS=-shared}"
+ fi
else
DLLD="${DLLD=ld}"
fi
! if test -n "$GCC"; then
DLCFLAGS="${DLCFLAGS=-fpic}"
else
case "$host_os" in
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh-3.1 development: dynamic modules
1996-11-06 21:38 zsh-3.1 development: dynamic modules Zoltan Hidvegi
` (2 preceding siblings ...)
1996-11-07 17:35 ` (Apology) " Bart Schaefer
@ 1996-11-08 8:51 ` Peter Stephenson
1996-11-10 10:59 ` Andrej Borsenkow
4 siblings, 0 replies; 7+ messages in thread
From: Peter Stephenson @ 1996-11-08 8:51 UTC (permalink / raw)
To: Zsh hackers list
Zoltan Hidvegi wrote:
> This is very experimental. You have to give the --enable-dynamic option to
> configure to compile in binary module support. This adds a new builtin,
> modload. Whithout arguments it lists the currently loaded modules.
> Otherwise it loads the given module. The $module_path array is user to
> seatch for the modules. modload -u modue unloads the given module.
I just remembered... modload is an existing command on solaris to load
kernel modules. It's not something the average user is going to be
doing, but I suggest it's probably better to start on the right foot
and avoid a clash and associated confusion (suppose the user looks for
a manual page on modload). How about zmodload? That's more explicit
about it being a zsh module.
*** Src/hashtable.h.old Fri Nov 8 09:38:02 1996
--- Src/hashtable.h Fri Nov 8 09:38:41 1996
***************
*** 304,310 ****
#endif
#ifdef DYNAMIC
! {NULL, "modload", 0, bin_modload, 0, -1, 0, "uf", NULL},
#endif
{NULL, "popd", 0, bin_cd, 0, 2, BIN_POPD, NULL, NULL},
{NULL, "print", BINF_PRINTOPTS, bin_print, 0, -1, BIN_PRINT, "RDPnrslzNu0123456789pioOcm-", NULL},
--- 304,310 ----
#endif
#ifdef DYNAMIC
! {NULL, "zmodload", 0, bin_zmodload, 0, -1, 0, "uf", NULL},
#endif
{NULL, "popd", 0, bin_cd, 0, 2, BIN_POPD, NULL, NULL},
{NULL, "print", BINF_PRINTOPTS, bin_print, 0, -1, BIN_PRINT, "RDPnrslzNu0123456789pioOcm-", NULL},
*** Src/module.c.old Fri Nov 8 09:38:03 1996
--- Src/module.c Fri Nov 8 09:38:26 1996
***************
*** 127,133 ****
/**/
int
! bin_modload(char *nam, char **args, char *ops, int func)
{
LinkNode node;
Module m = NULL;
--- 127,133 ----
/**/
int
! bin_zmodload(char *nam, char **args, char *ops, int func)
{
LinkNode node;
Module m = NULL;
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: zsh-3.1 development: dynamic modules
1996-11-06 21:38 zsh-3.1 development: dynamic modules Zoltan Hidvegi
` (3 preceding siblings ...)
1996-11-08 8:51 ` Peter Stephenson
@ 1996-11-10 10:59 ` Andrej Borsenkow
1996-11-11 3:42 ` Roderick Schertler
4 siblings, 1 reply; 7+ messages in thread
From: Andrej Borsenkow @ 1996-11-10 10:59 UTC (permalink / raw)
To: Zoltan Hidvegi; +Cc: Zsh workers list
I tried it on Sinix 5.42. It is SVR4-derived system with -ldl library. At
least Perl 5.003 DynaLoad works O.K.
There are many problems about autoconf, but it could be solved in future.
The crucial problem is:
on some systems (our at least; I take it to be true for other SVR4 as
well) the statically linked symbols are *not* available to dynamic
loader. I am not aware of any options to change it. Applied to
ZSH it means, that `addbuiltin' command (when called from loaded module)
*is not found* :-(
Note, that Perl is built as two parts - "startup" command and library,
which contains actual Perl code. I think, the above problem is one reason
for it. Giving long development cycle of Perl, it probably the only
portable solution.
It means, that ZSH should be splitted in small kernel and (probably
several) dynamically loaded modules. At least those sysmbols, which need
to be accessable from modules, should be in dyna part. But I think, if
such rewrite is ever necessary, it would be nice to modularize code; as
example, whole zle_* part could probably be made separate module (and
loaded only in interactive shell).
BTW code of Tcl 7.5 is in *.so library as well.
I would be glad to here, that I am wrong.
greetings
-------------------------------------------------------------------------
Andrej Borsenkow Fax: +7 (095) 252 01 05
SNI ITS Moscow Tel: +7 (095) 252 13 88
NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 7+ messages in thread