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

RE: Dynamic loading on Cygwin - status



>
>
> > > - 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



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