Kirix Support Forums

DLL vs Static

Please post all general questions, comments, bug reports, and any other wxWebConnect feedback here.

DLL vs Static

Postby NuSkooler on Mon Aug 24, 2009 12:08 pm

Hello,

First off thanks for wxWebConnect! We've experimented with using the old wxMozilla, our own wxMozillaXre, and lately wxWebKit -- wxWebConnect blows them all away!

On to my question:
Our product builds & uses wxWidgets as shared DLLs, how do I setup & compile wxWebConnect to output as a DLL and/or use the wxWidgets DLLs VS static libs?

I tried modifying the project files to use the vc_dll/ directories instead of vc_lib as well as defining WXUSINGDLL. This results in a bunch of errors like this:
Code: Select all
webcontrol.cpp(55) : error C2491: 'wxWebEvent::ms_classInfo' : definition of dllimport static data member not allowed


Any ideas?
NuSkooler
Registered User
 
Posts: 2
Joined: Mon Aug 24, 2009 12:00 pm

Re: DLL vs Static

Postby Ben on Mon Aug 24, 2009 11:38 pm

Hello,

Did you try to declare the classes with WXEXPORT? I recommend comparing how this is done in wxAUI with wxWebConnect.

All the best,
Ben
Ben Williams
Kirix Support Team
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Re: DLL vs Static

Postby NuSkooler on Tue Aug 25, 2009 12:18 pm

I've compared to wxAUI & got a little further but am still having issues. Here is what I've done:

webconnect project modified to create a DLL:
  • Changed all class definitions to "class WXDLLIMPEXP_AUI theClassName"
  • preprocessor defines: WXUSINGDLL and WXMAKINGDLL_AUI defined.
The combination of the two sets WXDLLIMPEXP to WXEXPORT, thus "class WXEXPORT theClassName". This works for creating a DLL.

testapp project modified in attempt to use webconnect.dll:
  • preprocessor defines: WXUSINGDLL and WXUSINGDLL_AUI

This results in the following at build time:
Code: Select all
1>testapp.obj : error LNK2001: unresolved external symbol "protected: static struct wxEventTable const wxFrame::sm_eventTable" (?sm_eventTable@wxFrame@@1UwxEventTable@@B)
1>testapp.obj : error LNK2001: unresolved external symbol "class wxPoint const wxDefaultPosition" (?wxDefaultPosition@@3VwxPoint@@B)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxMessageBoxCaptionStr" (?wxMessageBoxCaptionStr@@3QB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxEmptyString" (?wxEmptyString@@3PB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "protected: static class wxAppConsole * wxAppConsole::ms_appInstance" (?ms_appInstance@wxAppConsole@@1PAV1@A)
1>testapp.obj : error LNK2019: unresolved external symbol "public: void __thiscall wxWebPreferences::SetIntPref(class wxString const &,int)" (?SetIntPref@wxWebPreferences@@QAEXABVwxString@@H@Z) referenced in function "public: __thiscall MyFrame::MyFrame(class wxWindow *,int,class wxString const &,class wxPoint const &,class wxSize const &,long)" (??0MyFrame@@QAE@PAVwxWindow@@HABVwxString@@ABVwxPoint@@ABVwxSize@@J@Z)
1>testapp.obj : error LNK2001: unresolved external symbol "class wxValidator const wxDefaultValidator" (?wxDefaultValidator@@3VwxValidator@@B)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxComboBoxNameStr" (?wxComboBoxNameStr@@3QB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "class wxSize const wxDefaultSize" (?wxDefaultSize@@3VwxSize@@B)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxStatusLineNameStr" (?wxStatusLineNameStr@@3QB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxFrameNameStr" (?wxFrameNameStr@@3QB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "wchar_t const * const wxFileDialogNameStr" (?wxFileDialogNameStr@@3QB_WB)
1>testapp.obj : error LNK2001: unresolved external symbol "public: static enum wxTextFileType const wxTextBuffer::typeDefault" (?typeDefault@wxTextBuffer@@2W4wxTextFileType@@B)
1>testapp.obj : error LNK2001: unresolved external symbol "protected: static class wxAppConsole * (__cdecl* wxAppConsole::ms_appInitFn)(void)" (?ms_appInitFn@wxAppConsole@@1P6APAV1@XZA)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_NULL" (?wxEVT_NULL@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_DOMCONTENTLOADED" (?wxEVT_WEB_DOMCONTENTLOADED@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_SHOULDHANDLECONTENT" (?wxEVT_WEB_SHOULDHANDLECONTENT@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_INITDOWNLOAD" (?wxEVT_WEB_INITDOWNLOAD@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_SHOWCONTEXTMENU" (?wxEVT_WEB_SHOWCONTEXTMENU@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_TITLECHANGE" (?wxEVT_WEB_TITLECHANGE@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_LOCATIONCHANGE" (?wxEVT_WEB_LOCATIONCHANGE@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_STATECHANGE" (?wxEVT_WEB_STATECHANGE@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_STATUSCHANGE" (?wxEVT_WEB_STATUSCHANGE@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_WEB_STATUSTEXT" (?wxEVT_WEB_STATUSTEXT@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_UPDATE_UI" (?wxEVT_UPDATE_UI@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_COMMAND_MENU_SELECTED" (?wxEVT_COMMAND_MENU_SELECTED@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_COMMAND_COMBOBOX_SELECTED" (?wxEVT_COMMAND_COMBOBOX_SELECTED@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_COMMAND_TEXT_ENTER" (?wxEVT_COMMAND_TEXT_ENTER@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_ERASE_BACKGROUND" (?wxEVT_ERASE_BACKGROUND@@3HB)
1>testapp.obj : error LNK2001: unresolved external symbol "int const wxEVT_SIZE" (?wxEVT_SIZE@@3HB)


Testapp is being linked against all of the proper wxWidgets libs as well as the new webconnect.lib (DLL version). I've build both 100% clean. I'm probably missing something obvious?

Thanks again for any additional information!
NuSkooler
Registered User
 
Posts: 2
Joined: Mon Aug 24, 2009 12:00 pm

Re: DLL vs Static

Postby affi on Wed Oct 14, 2009 4:34 am

got the same problem.

I then created a simple TestApp with customized settings and this one works.
You could try to delete the TestApp Projekt and recreate it.
affi
Registered User
 
Posts: 1
Joined: Wed Oct 14, 2009 4:24 am

Re: DLL vs Static

Postby myersa on Tue May 03, 2011 10:25 am

Hello,

Before you read on, I have no solutions to offer, so if that's what you're looking for, read no further.

I've been tearing my hear out for a day and a half trying to get this to work as a DLL. There are literally hundreds of class definitions and forward declarations for which a macro must be added (e.g. WXDLLIMPEXP_AUI and WXDLLIMPEXP_FWD_AUI), and there are linker errors (unresolved external symbols to things like "wxEmptyString") that shouldn't even be there (yes, I triple-checked the include & linker paths and made sure WXUSINGDLL was defined).

Based on what I've seen from the sample app (which I DID get working by re-building my wxWidgets library as a static lib), the product is excellent, but I've never had such a difficult time trying to adapt something to the needs of my project (i.e. using wxWidgets as a DLL).

Please, consider making the next release flexible enough to work as a DLL or as a static library right out of the box - adding "Debug_DLL" and "Release_DLL" build configurations would be most welcome.
myersa
Registered User
 
Posts: 4
Joined: Mon May 02, 2011 6:07 pm

Return to wxWebConnect Questions, Thoughts & Feedback