On 12/7/05, Timothy Wall <twall@oculustech.com> wrote:
>
> On Dec 7, 2005, at 7:08 AM, Ivan Zhakov wrote:
>
> > I have discovered problems:
> > http://msdn2.microsoft.com/en-us/library/619w14ds.aspx
> > In a few words: On Windows exporting variable means exporting
> > *pointer* to this variable and importing must dereference it.
> > __declspec(dllexport)/__declspec(dllimport) makes this automatically.
> > So I see several ways:
> > 1. Use __declspec(dllimport) for variables only. Causes special define
> > for *each* dll to separate dll building dll from importing.
> > 2. Use __declspec(dllimport) everywhere on windows -- anyway causes
> > usage special define per library and change signature of all API.
> > 3. Never export/import data between libraries. I don't sure that this
> > can be done.
>
> We use a utility program to generate the list of exports and then
> specify explicitly those things we do (or don't) want exported. This
> file is passed to the linker (.def). We find this preferable to
> littering header files with tons of declspec cruft.
Thanks, we already have done this (extractor.py). But we run into
problem with exporting/importing *variables*, not functions.
--
Ivan Zhakov
Received on Wed Dec 7 14:28:26 2005