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

Dynamic loading under Cygwin



It looks pretty doable. To do it we need

1. make sure, that symbols get `dllexport' in module source and
`dllimport' everywhere else

2. compile dll and stub library

3. link against stub library

(there may be one more point - I do not know, if Cygwin supports
LD_RUN_PATH or equiv. We may need to install DLLs into $bindir instead
of $libdir).

So

1. It is easy enough. Just let *.mdh files redefine mod_export as
`__declspec(dllimport)' if IMPORTING_MODULE_* is defined and
`__declspec(dllexport)' otherweise. The files are automatically
generated so it needs change in one place only. (It may conflict with
current usage of mod_export - but it shouldn't be so hard to solve).
There may be problems, if Cygwin does not allow more than one
declaration with dllexport flag. This should be doable as well (we can
define dllexport at the *end* of *.mdh files after all *.epro files are
included. Then only real definitions will get dllexport flag).

2. Well, playing with dllwrap shows, that this is trivial. It does
everything in one nice pass; just specify object files and names of
output files.

3. THAT makes me uneasy. It means, that if one module depends on
another, it has to be linked with stub library for the later. Shudder.
While it is definitely possible in closed environment, it makes
stand-alone module compilation even less likely. Stub library is not
needed, if we use dlopen()/dlsym() interface (it hardly makes any
performance difference). May be, it is even possible to automate it
(thus duplicating decent run-time loader on normal OS :-) Else we
eventually should install stub libraries somewhere to be available. May
be, it is easier.

-andrej

Have a nice DOS!
B >>



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