MSVS: non dll-interface - WARNING

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

MSVS: non dll-interface - WARNING

Post by cutecode »

Why do I get "non dll-interface" warning on MS VS only
I don't have this warning on Linux,MAC and windows code::blocks

Code: Select all

wxInterpriter.h(178): warning C4275: non dll-interface class 'wxPtrArrayOfVarObjs' used as base for dll-interface class 'wxPtrArray_' (sendfile.cpp)
wxInterpriter.h(174) : see declaration of 'wxPtrArrayOfVarObjs'
wxInterpriter.h(177) : see declaration of 'wxPtrArray_'
Here are my declarations

Code: Select all

#if defined(__WXMSW__)
    #ifndef __WXDLLMAIN__
        #define __WXDLLMAIN__LIB__ __declspec(dllimport)
    #else
        #define __WXDLLMAIN__LIB__ __declspec(dllexport)
    #endif
#else
    #ifndef __WXDLLMAIN__
        #define __WXDLLMAIN__LIB__
    #else
        #define __WXDLLMAIN__LIB__
    #endif
#endif

Code: Select all

class  __WXDLLMAIN__LIB__ wxVarObjs
{

Code: Select all

WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxVarObjs*, wxPtrArrayOfVarObjs, class __WXDLLMAIN__LIB__);

Code: Select all

 class __WXDLLMAIN__LIB__ wxPtrArray_ : public wxPtrArrayOfVarObjs
{
public:
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: MSVS: non dll-interface - WARNING

Post by PB »

Firstly, why are you still using these long-deprecated classes? The documentation clearly states they are not to be used in the new code.

Secondly, why are you using the macro differently than in the documentation: Should the macro not take the care about the class export declaration without you doing it?
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: MSVS: non dll-interface - WARNING

Post by stahta01 »

User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: MSVS: non dll-interface - WARNING

Post by cutecode »

Hello

changing from WX_DEFINE_USER_EXPORTED_ARRAY_PTR to WX_DEFINE_ARRAY or WX_DEFINE_USER_EXPORTED_ARRAY
gives the same warning on MSVS
Безымянный.png
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
stahta01
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 548
Joined: Fri Nov 03, 2006 2:00 pm

Re: MSVS: non dll-interface - WARNING

Post by stahta01 »

Do you have any reason to believe you can sub class the result?

I am not an C++ expert; I am just a C++ beginner or early intermediate level; but, that seems like a idea that is not valid.

Tim S.
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: MSVS: non dll-interface - WARNING

Post by cutecode »

stahta01 wrote: Thu Aug 05, 2021 1:17 am Do you have any reason to believe ...

Code: Select all

on MS VS only
I don't have this warning on Linux,MAC and windows code::blocks
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: MSVS: non dll-interface - WARNING

Post by PB »

I think the warning is pretty clear, you need to decide whether it is valid in this case, as described in the bullets in its description.

I also do not find surprising that you do not get this warning with GCC, many compiler warnings are compiler- or even compiler-version-specific.

BTW, I am also no C++ (or anything else) expert.
User avatar
cutecode
Super wx Problem Solver
Super wx Problem Solver
Posts: 425
Joined: Fri Dec 09, 2016 7:28 am
Contact:

Re: MSVS: non dll-interface - WARNING

Post by cutecode »

I got this warning after moving to wx-3.1.6

I got my backup from old wx-3.1.1 and rebuiled the project.
And I don't have this warning in wx-3.1.1

Both versions are working stable anyway.

But this warning is annoying in wx-3.1.6 ))))

Thank you!
wx 3.1.6 win/mac/linux

regards,
Alexander Saprykin
https://v2.dental-soft.ru
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4182
Joined: Sun Jan 03, 2010 5:45 pm

Re: MSVS: non dll-interface - WARNING

Post by PB »

cutecode wrote: Sun Aug 08, 2021 12:24 pm I got this warning after moving to wx-3.1.6

I got my backup from old wx-3.1.1 and rebuiled the project.
And I don't have this warning in wx-3.1.1
This is probably due to this change: https://github.com/wxWidgets/wxWidgets/ ... 7891e731b3
cutecode wrote: Sun Aug 08, 2021 12:24 pm But this warning is annoying in wx-3.1.6 ))))
If all it is is just being annoying, just suppress the warning, wxWidgets does it when its containers derive from the std ones.
Post Reply