Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: dynamic loading on Cygwin



This was easier as I expected. Patch is pretty small and main change is in
mkmakemod.sh.

Changes:

- configure values are hardcoded, like for AIX. They are based on my
experience :-)

- mod_export is defined as ``__attribute__((__dllexport__))'' to make such
objects automatically exported.

- imported objects generally need ``__attribute__((__dllimport__))''. Because
it is not possible to take address of such objects in static context, and it
is often used for imported functions, I added two declarators:
mod_import_function and mod_import_variable. mod_import_function is empty and
mod_import_variable is normally defined as aboce on Cygwin. They appear only
in epro files; mkproto.awk generates them appropriate declarator  from
mod_export.

- if module depends on another module, it has to be linked with it's DLL. So,
the major change was in mkmakemod.sh to generate dependencies and proper link
commands. Actually, this contains the majority of Cygwin dependencies.

- this installs libzsh.dll into bindir. No fancy installation, because it
currently fails as long as Zsh runs anyway

- I had to put code from main() into init.c to avoid mod_export'ing everything
that is needed. So, main() now is really dummy.

- libzsh is linked against $(LIBS); this should not be a problem (I hope) as
any other module does it already.

- there were a couple of missing mod_export's

I'm using this version on both Unix and Cygwin; on Cygwin the failed tests
are:

- special files (there is no on Cygwin)
- process substitution (no FIFO or /dev/fd support)
- cd with chase_links; this looks like a bug in current Cygwin version (it was
O.K. before)
- all tests that use zpty. This is next on TODO list :-)

I could not test it on Unix that needs extra libzsh.so (I do not have it).

As mentioned, on Cygwin you need at least binutils-20000722-1. Version,
distributed in June, 2000, has problems with dllwrap; and older versions
porbably cannot link directly with DLL. I tested it with Cygwin-1.1.3-1
(prerelease).

cheers

-andrej

Have a nice DOS!
B >>

Attachment: zsh-cygwin.diff
Description: Binary data



Messages sorted by: Reverse Date, Date, Thread, Author