dllimport/export problem upgrading to STLPort 4.5 (under Visual C++ 6.0) 
Author Message
 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



Sun, 04 Apr 2004 02:22:37 GMT  
 dllimport/export problem upgrading to STLPort 4.5 (under Visual C++ 6.0)
Just some additional data... It looks like if I declare
_STLP_DESIGNATED_DLL in DLL A, then I can make the warnings and errors
go away in DLL B by also defining _STLP_DESIGNATED_DLL in DLL B. That
doesn't appear to be safe based on the documentation, but it does make
the symptom of the compiler warnings and errors disappear.

Also, I have the same problem when I finally build an executable - if
I don't also define _STLP_DESIGNATED_DLL even in the executable, I get
the same set of warnings and errors. But if I do define
_STLP_DESIGNATED_DLL in the executable, it *seems* to work fine.

So is the answer to define _STLP_DESIGNATED_DLL in *all* DLLs as well
as the final executable??

        Thanks,
                Ethan Shayne



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




Sun, 04 Apr 2004 03:50:44 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem with Visual Studio 6.0 (Visual C++ 6.0) !!!!

2. Borland C++ 4.5 vs Visual C++

3. Creating DLL for Vb 6.0 with Borland C++ 4.5

4. STLport 4.5 and VC7.1

5. Visual C++ .NET reviews, comparisons to Visual C++ 6.0

6. Visual C++ 6.0 vs. Visual C++ .NET

7. Visual C++ 6.0 contra Visual C++ Technology Preview IE4

8. DoModal Visual C++ 6.0 and Visual C++ .NET?

9. Visual C++ 6.0 contra Visual C++ Technology Preview IE4

10. Is there a way to merge visual C++ 6.0 and Embedded visual C++ 4.0

11. exporting a c .obj to QuickBasic 4.5?

12. Problem Exporting Window Functions from Visual c++

 

 
Powered by phpBB® Forum Software