
dllimport/export problem upgrading to STLPort 4.5 (under Visual C++ 6.0)
I have been using
Visual C++ 6.0 (SP5) and STLPort 4.0. Under this
combination, I had several DLLs that compiled and worked fine. All
classes in these DLLs have some STL-based member data (strings, maps,
etc). All DLLs also export some classes which contain APIs which
include passing around STL-based classes (e.g. passing a string as a
parameter to a member function, or returning a string from a member
function). On top of that, the DLLs are layered on each other - DLL A
exists standalone, but DLL B relies on DLL A. Also, FWIW, I am using
the "wrapper" version of STLPort - I am not using an STLPort library,
not using the STLPort IOStreams, etc.
Under STLPort 4.0 I had DLL A compiling with both the
__STL_USE_DECLSPEC and __STL_DESIGNATED_DLL flags. DLL B was set up
with just the __STL_USE_DECLSPEC flag. This all seemed to be working
ok.
I recently tried to upgrade to STLPort 4.5. I noticed that the flag
names had changed, so I changed DLL A to build with _STLP_USE_DECLSPEC
and _STLP_DESIGNATED_DLL, and I changed DLL B to build with
_STLP_USE_DECLSPEC.
Now, DLL A compiles ok. DLL B, however, now gives me tons of
compile-time warnings:
D:\DEV\3RDPARTY\STLPORT-4.5\STLPORT\stl/_alloc.c(63) : warning C4273:
'_S_oom_malloc' : inconsistent dll linkage. dllexport assumed.
D:\DEV\3RDPARTY\STLPORT-4.5\STLPORT\stl/char_traits.h(131) : while
compiling class-template member function 'void *__cdecl
_STL::__malloc_alloc<0>::_S_oom_malloc(unsigned int)'
And also some errors:
D:\DEV\3RDPARTY\STLPORT-4.5\STLPORT\stl/_alloc.c(293) : error C2491:
'__malloc_alloc<0>::__oom_handler' : definition of dllimport static
data member not allowed
D:\DEV\3RDPARTY\STLPORT-4.5\STLPORT\stl/char_traits.h(131) : while
compiling class-template static data member 'void (__cdecl *__cdecl
_STL::__malloc_alloc<0>::__oom_handler)(void)'
What am I missing from the upgrade process here?
Thanks,
Ethan Shayne