auto-import STATUS

Danny Smith
Fri Aug 3 16:36:00 GMT 2001

> 3. Danny Smith reports an esoteric problem:
>     "I am still having some (sorry, one very specific) problem
>     with C++ and auto-import.  It is with cerr, cin, cout in
>     the STLport of the SGI iostream lib.  These are initialised
>     before main.  When building dll with auto-export and using
>     auto-import to link (no dllimport attributes), I get
>     successful link, but runtime failure of app at initialisation
>     (before main). When building dll with --export-all, but
>     marking DATA with dllimport when compiling client, I get
>     successful link and run."

In the event, the problem I reported with STLPort probably has nothing
to do with dllimport/dllexport attributes.  Instead, I think it stems
from differences in the way basic_[io]stream::sentry is constructed in
dll vs static lib in this implemntation. In dll, sentry is typedef
(within scope of surronding stream class) for standalone separate
class, in static lib sentry is an inner class, defined within the basic
stream classes. Another difference between dynamic linking and static
linking revolves around what is exposed in the header: with DLL linkage
cannot expose the "general" template definitions of helper templates,
unless explicitly declare each and every  char and wchar_t  that does
reside in the dll as a specialisation.

If I use the static lib class definitions and --export-all to build the
lib, but the dll class definitions (sans __attribute__(dllimport)) 
when building the client and --enable-auto-import, I get no errors with
dll-dependent test app.  

I still don't understand the logic completely, but I cannot get
iostreams to initialise properly, using DLL,  with  [io]stream::sentry
defined as inner class by client app, regardless of the dllimport
attribute markings.

There is a caveat here somewhere about C++ dlls. One of them being not
to let DS lose around templates.


_____________________________________________________________________________ - Yahoo! Messenger
- Voice chat, mail alerts, stock quotes and favourite news and lots more!

More information about the Cygwin-apps mailing list