wxPdfDoc-0.9.2.1 & wx-2.9.3 Topic is solved

Talk here about issues with one of the components hosted at wxCode, or suggest features for it.
Post Reply
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

wxPdfDoc-0.9.2.1 & wx-2.9.3

Post by xaviou »

Hi to all.

I've got a little problem while building an application with wx-2.9.3.

This application is made of a shared lib and an executable.

I've added the last wxPdfDoc's sources and headers to the lib's one, and added "WXMAKINGDLL_PDFDOC" to the compiler and the linker options.

If I build it with wx-2.8.12, no problem : the wxPdfDoc is available in the lib.
If I build it with wx-2.9.3, there are no symbols of wxPdfDoc exported.

The settings for both wx-2.8.12 and wx-2.9.3 are the same (I just added wxDEBUG_LEVEL=0 for wx-2.9.3).
I added the option for creating the static lib file : the wx-2.8.12 has a size of about 2Mo, the wx-2.9.3 one is about 430Ko

Windows 7 - Code::Blocks Nightly-Build - gcc-4.5.2-TDM - wx-2.9.3-32bits (not tested yet with 64bits).

Did I missed something ? Is there an option that must be added for building with wx-2.9.3 ?

Thanks in advance for the replies.

Regards

Xav'
My wxWidgets stuff web page : X@v's wxStuff
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDoc-0.9.2.1 & wx-2.9.3

Post by utelle »

xaviou wrote:I've got a little problem while building an application with wx-2.9.3.

This application is made of a shared lib and an executable.

I've added the last wxPdfDoc's sources and headers to the lib's one, and added "WXMAKINGDLL_PDFDOC" to the compiler and the linker options.

If I build it with wx-2.8.12, no problem : the wxPdfDoc is available in the lib.
If I build it with wx-2.9.3, there are no symbols of wxPdfDoc exported.

The settings for both wx-2.8.12 and wx-2.9.3 are the same (I just added wxDEBUG_LEVEL=0 for wx-2.9.3).
Most probably there is a difference otherwise the symbols would not be missing. There are no known compile issues for wxPdfDocument used with wxWidgets 2.9.x. If WXMAKINGDLL_PDFDOC is defined the symbol WXEXPORT defined by wxWidgets itself is referenced. Maybe the symbol WXEXPORT is incorrectly defined due to other settings. Please show all settings you have defined.
xaviou wrote:I added the option for creating the static lib file : the wx-2.8.12 has a size of about 2Mo, the wx-2.9.3 one is about 430Ko
Are you sure your project references all source files belonging to wxPdfDocument? 430 kB definitely sounds way too small.
xaviou wrote:Windows 7 - Code::Blocks Nightly-Build - gcc-4.5.2-TDM - wx-2.9.3-32bits (not tested yet with 64bits).

Did I missed something ? Is there an option that must be added for building with wx-2.9.3 ?
As I don't use Code::Blocks myself I can't tell much about Code::Block specifics, but I can tell you that there are no special symbols required for building wxPdfDocument for wxWidgets 2.9.3.

Regards,

Ulrich
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxPdfDoc-0.9.2.1 & wx-2.9.3

Post by xaviou »

Hi
utelle wrote:Maybe the symbol WXEXPORT is incorrectly defined due to other settings. Please show all settings you have defined.
It seems to be a WXEXPORT problem : to clarify this, I tried adding the folowing lines in "pdfdocdef.h" :

Code: Select all

#if EXPORT_LIB // a private define for the other symbols of my shared lib
    #ifdef WXEXPORT
        #undef WXEXPORT
        #define WXEXPORT __declspec (dllexport)
    #endif
#else
    #ifdef WXIMPORT
        #undef WXIMPORT
        #define WXIMPORT __declspec (dllimport)
    #endif
#endif
With this block of code : all is ok : the shared and the static libs have the wxPdfDoc symbols exported.
Here are the settings fo the project :
  • __GNUWIN32__ : building with gcc-4.5.2-TDM
  • __WXMSW__ : I'm working under Windows
  • WXUSINGDLL : Using the shared multi-libs version of wxWidgets
  • wxUSE_UNICODE
  • EXPORT_LIB : the "export" define for the other stuff in my lib
  • WXMAKINGDLL_PDFDOC : sources of wxPdfDoc are include in my lib, so it's like if I was byuilding the dll of wxPdfDoc
  • -Wall, -pipe, -mthreads
  • wxDEBUG_LEVEL=0 : to avoid the "undefined reference to wxAssertHandler"-like errors at link time.
utelle wrote:
xaviou wrote:I added the option for creating the static lib file : the wx-2.8.12 has a size of about 2Mo, the wx-2.9.3 one is about 430Ko
Are you sure your project references all source files belonging to wxPdfDocument? 430 kB definitely sounds way too small.
I'm sure : the dll has a size of more than 3.4 Mo. Only the ".a" file is 430Ko (and it comes to more than 2Mo with the block above).

I'll try to see why this WXEXPORT symbol is not defined correctly.

Thank-you for your reply

Regards

Xav'
My wxWidgets stuff web page : X@v's wxStuff
utelle
Moderator
Moderator
Posts: 1125
Joined: Tue Jul 05, 2005 10:00 pm
Location: Cologne, Germany
Contact:

Re: wxPdfDoc-0.9.2.1 & wx-2.9.3

Post by utelle »

xaviou wrote:It seems to be a WXEXPORT problem : to clarify this, I tried adding the folowing lines in "pdfdocdef.h" :

Code: Select all

#if EXPORT_LIB // a private define for the other symbols of my shared lib
    #ifdef WXEXPORT
        #undef WXEXPORT
        #define WXEXPORT __declspec (dllexport)
    #endif
#else
    #ifdef WXIMPORT
        #undef WXIMPORT
        #define WXIMPORT __declspec (dllimport)
    #endif
#endif
With this block of code : all is ok : the shared and the static libs have the wxPdfDoc symbols exported.
This seems to be a problem caused by changes in the wxWidgets header file dlimpexp.h introduced in wxWidgets version 2.9.2 for GCC version 4.5 and above. For this compiler the symbols WXEXPORT and WXIMPORT are no longer defined. There is a comment reading
While gcc also supports __declspec(dllexport), it creates unusably huge
DLL files since gcc 4.5 (while taking horribly long amounts of time),
see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43601. Because of this
we rely on binutils auto export/import support which seems to work
quite well for 4.5+.
Maybe one needs to do something to enable this auto export/import feature. Since I use Visual C++ and not GCC under Windows I can't give further advise unfortunately.

Regards,

Ulrich
User avatar
xaviou
Super wx Problem Solver
Super wx Problem Solver
Posts: 437
Joined: Mon Aug 21, 2006 3:18 pm
Location: Annecy - France
Contact:

Re: wxPdfDoc-0.9.2.1 & wx-2.9.3

Post by xaviou »

Hi

I finally got it to work :
The "auto-export" feature of gcc is enabled by default.
But it is disabled if any "__declspec(dllexport)" is used in the lib (that was my case).

And to use the "auto-import" functionnality, I just had to directly link to the dll file instead of the ".a" file.

Thanks again for you replies.

Edit : Successfully build with wx-2.9.3-64 bits. Just 2 problems encountered in pdfbarcode.cpp (errors for conversion from wxUniChar to long long int):

Code: Select all

// line 334 : replaced
    codeExt += code39_encode[code[i]];
// by
    codeExt += code39_encode[(int)code[i]];

// Line 1398 : replaced
    bars = code128_bars[*ch];
// by
    bars = code128_bars[(int)*ch];
Regards

Xav'
My wxWidgets stuff web page : X@v's wxStuff
Post Reply