* Dynamic loading on Cygwin - status
@ 2000-07-28 14:51 Andrej Borsenkow
2000-07-28 16:17 ` Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2000-07-28 14:51 UTC (permalink / raw)
To: ZSH workers mailing list
O.K., it almost works :-) It was much easier than I suspected due to the fact,
that you can simply link with DLL - no additional stub library is needed. That
enourmosly simplified makefiles.
There are still some gotchas:
- for dlsym() to find a symbol, it has to explcitly exported. It means, that
module's setup() etc functions are not found. They has to be defined with
__attribute__((__dllexport__)). All exported symbols (that have mod_export)
currently get this automatically.
- external function or variable imported from another module is not considered
a constant on Cygwin (actually, on Windows). Hence, any static initializer
fails, e.g
BUILTIN("cap", 0, bin_cap, 0, 1, 0, NULL, NULL),
where bin_cap is redefined to bin_notavail that in imported from mail DLL.
This is not just as easy to solve.
- some more Makefiles tweaking is needed; because now modules depend on other
module's DLL, we need rules to rebuild them.
- of course, zsh.dll has to be installed into $(bindir) else it is not found.
But still, I did run Zsh compiled with dynamic loading support :-))) My thanks
to Zefram for excellent build system! (And good configure tests).
-andrej
Have a nice DOS!
B >>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Dynamic loading on Cygwin - status
2000-07-28 14:51 Dynamic loading on Cygwin - status Andrej Borsenkow
@ 2000-07-28 16:17 ` Andrej Borsenkow
2000-07-31 13:58 ` Peter Stephenson
0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2000-07-28 16:17 UTC (permalink / raw)
To: ZSH workers mailing list
>
> - for dlsym() to find a symbol, it has to explcitly exported. It means, that
> module's setup() etc functions are not found. They has to be defined with
> __attribute__((__dllexport__)). All exported symbols (that have mod_export)
> currently get this automatically.
>
dllwrap --export-all-symbols
Do you understand now, why Win32 programs have such a size? :-)
(This is quick fix. As we actually need just four functions in addition to
mod_export'ed, it is better to define additional token that is defined on
Cygwin to __attr...)
> - external function or variable imported from another module is not
> considered
> a constant on Cygwin (actually, on Windows). Hence, any static initializer
> fails, e.g
That is really bad. Alternatives are
- compile such module into main DLL. We may somehow automate it by putting
hint into .mdd file
- pretend itself run-time linker and resolve address itself.
- rewrite zsh in C++ ...
Now I *really* have working Zsh will dynamic loading. Unfortunately,
completion is not really useable without parameters module ... just tried
zmodload zsh/mapfile
vared 'mapfile[init.syms]'
it works!
-andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Dynamic loading on Cygwin - status
2000-07-28 16:17 ` Andrej Borsenkow
@ 2000-07-31 13:58 ` Peter Stephenson
2000-07-31 14:08 ` Andrej Borsenkow
0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2000-07-31 13:58 UTC (permalink / raw)
To: Zsh hackers list
> > - external function or variable imported from another module is not
> > considered
> > a constant on Cygwin (actually, on Windows). Hence, any static initializer
> > fails, e.g
>
> That is really bad.
Isn't it enough to mark it as __attribute__((dllimport)) in the importing
file (assuming the symbol's exported in the first place, obviously)?
--
Peter Stephenson <pws@csr.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Dynamic loading on Cygwin - status
2000-07-31 13:58 ` Peter Stephenson
@ 2000-07-31 14:08 ` Andrej Borsenkow
0 siblings, 0 replies; 4+ messages in thread
From: Andrej Borsenkow @ 2000-07-31 14:08 UTC (permalink / raw)
To: Peter Stephenson, Zsh hackers list
>
>
> > > - external function or variable imported from another module is not
> > > considered
> > > a constant on Cygwin (actually, on Windows). Hence, any static
> initializer
> > > fails, e.g
> >
> > That is really bad.
>
> Isn't it enough to mark it as __attribute__((dllimport)) in the importing
^^^^^^^^^^^^^^^^^^^^^^^^^^
> file (assuming the symbol's exported in the first place, obviously)?
>
Exactly THIS makes them non-static. But it is not bad as I thought. We do not
need dllimport declaration for functions. We still do need them for variables.
I'll try it as soon as I have time to see, if some external variable is used
in static context.
(It is clear. In case of variables, compiler actually generates code to call a
function that returns address. Of course, you cannot call function to
intialize static variable. In case of function what gets linked into program
under function's name is a stub that calls "real" function under the name
__imp__<function>. Of course, we can always take an address of this stub - it
is perfectly static).
-andrej
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-07-31 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-28 14:51 Dynamic loading on Cygwin - status Andrej Borsenkow
2000-07-28 16:17 ` Andrej Borsenkow
2000-07-31 13:58 ` Peter Stephenson
2000-07-31 14:08 ` Andrej Borsenkow
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).