On Fri, 16 Oct 2015 12:52:28 +0800 asmwarrior wrote:
a> Hi, I just see in the source \include\wx\dlimpexp.h
a>
a> /*
a> While gcc also supports __declspec(dllexport), it creates unusably huge
a> DLL files since gcc 4.5 (while taking horribly long amounts of time),
a> see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this
a> we rely on binutils auto export/import support which seems to work
a> quite well for 4.5+.
a> */
a> # elif defined(__GNUC__) && !wxCHECK_GCC_VERSION(4, 5)
a> /*
a> __declspec could be used here too but let's use the native
a> __attribute__ instead for clarity.
a> */
a> # define WXEXPORT __attribute__((dllexport))
a> # define WXIMPORT __attribute__((dllimport))
a> # endif
a>
a> Which means, if I build wx with gcc 4.5 or later, we don't have
a> dllexport decoration.
Yes.
a> But now, we can build wx with the option: -fno-keep-inline-dllexport
a> Such as stated in: Charles Wilson - [ANNOUNCEMENT] Updated: mingw-gcc-{core,g++,fortran,objc}-4.7.3-1; NEW:
a> -
https://cygwin.com/ml/cygwin/2013-07/msg00362.html
The post says that this option can be used for all files but one, but we
still need to generate DLL exported versions of inline methods from
somewhere, see the "source file, that includes all headers" part. I don't
understand how can things work if -fno-keep-inline-dllexport is used
globally, the inline methods then must not be exported from the library at
all and so any code using them with inlining disabled should fail to link.
a> So, my question is: can we enable the __declspec(dllexport) for later
a> GCC version(such as GCC 4.7 and later version) and combined with the
a> -fno-keep-inline-dllexport? The issue for the GCC bug #43601 is still
a> valid?
I haven't tested this with any recent gcc versions. It would be useful if
you could do it and let us know how do the numbers (object files size, DLL
size, build time) change if you remove "wxCHECK_GCC_VERSION(4, 5)" above.
a> Since I see an issue: if I want to export a symbol from my own dll, the
a> symbol is defined as:
a> WX_DECLARE_EXPORTED_OBJARRAY(RegExStruct, RegExArray);
First of all, you shouldn't use wx arrays at all unless there is a really
good reason to do it. Second, if you do use them, you should be using
WX_DECLARE_USER_EXPORTED_OBJARRAY() which allows you to specify your own
__attribute__((whatever)) as needed.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/