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

RE: Getting dynamic loading to work on cygwin



> :
> : Yuk, it looks like your right.  Using dlsym to get the
> symbol works OK, but
> : simply linking against the DLL and loading it doesn't seem
> to pick up the
> : right value.  That will screw up a lot of things.
>
> Data references can be imported on Win32, but you need help from the
> compiler to generate an extra indirection on access to the
> imported data.
> This of course implies that the compiler needs to know what data is
> being imported, which with normal Win32 compilers is indicated by
> decorating the extern declaration with '__import' or
> '__declspec(dllimport)'.
> I don't have cygwin or it's documentation handy, so I don't know if
> gcc supports this or some alternate spelling.
>

Cygwin supports __declspec(dllimport/export) but it different matter.
The following case works (foo.dll is assumed to access variable in
bar.dll)

build bar.dll that defines and exports variable
build foo.dll with bar stub library bar.a that directly references this
variable (extern ...)

the following case does not work

build bar.dll that defines and exports variable
build foo.dll that loads bar.dll with dlopen() and lokos up variable
with dlsym().

Variable is found but seems to point to the wrong location.

I did define variable with __declspec(dllexport) but it did not help.

-andrej



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