trouble with wxDynamicLibrary Topic is solved

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.
fischi
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Apr 18, 2008 11:02 am

Post by fischi » Mon May 05, 2008 7:19 am

Yes i have compiled the main app and the plugin as using wxWidgets as DLL. The attachment of the project will follow soon. At the moment there always occurs a failure when i try to upload the files.
i use MS VC++ 2005 Express, windows xp, wxWidgets 2.8.7

fischi
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Apr 18, 2008 11:02 am

Post by fischi » Mon May 05, 2008 10:57 am

the project files
Attachments
Basis_sourceforge.rar
main app
(5.24 KiB) Downloaded 56 times
Plugin_sourceforge.rar
plugin
(17.17 KiB) Downloaded 53 times
i use MS VC++ 2005 Express, windows xp, wxWidgets 2.8.7

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan » Mon May 05, 2008 12:10 pm

Hi,
if you have compiled the main app and the plugin using wxWidgets as DLL, you don't need to init wxWidgets library from DLL. Just comment out this code in the meineDLL.cpp:

Code: Select all

#include "meineDLL.h"

	extern "C" __declspec(dllexport) IEditorPlugin* CreatePlugin(){return new MyPlugin; }		
/*															
	IMPLEMENT_APP_NO_MAIN(PluginDLLApp)												
																					
	BOOL APIENTRY DllMain( HANDLE hModule,											
                       DWORD  ul_reason_for_call,									
                       LPVOID lpReserved											
	                                         )										
	{																				
		    switch (ul_reason_for_call)												
			{																		
                case DLL_PROCESS_ATTACH:											
                {       wxSetInstance((HINSTANCE)hModule);							
                        int argc = 0;												
                        char **argv = NULL;											
                        wxEntryStart(argc, argv);									
                }																	
                break;																
																					
                case DLL_THREAD_ATTACH:												
                break;																
																					
                case DLL_THREAD_DETACH:												
                break;																
																					
                case DLL_PROCESS_DETACH:											
                 wxEntryCleanup();
				break;																
			}																		
		return TRUE;																
	}																				
*/
void MyPlugin::EditNode()
{
	
	wxMessageBox(wxT("Hallo."));
	
   }

extern "C" void WXEXPORT DLLFunction(void) 
{ 

        wxMessageBox(wxT("Hallo2."));
} 
Look here for more information:
http://forums.wxwidgets.org/viewtopic.php?t=12680
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 387
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets » Tue May 06, 2008 2:41 am

Good thing you uploaded your project files :-)
It looks right now as though I have been wrong all along and had my current project, as well a your sample compiled with a _static_ version of wxWidgets - and both work as expected.

I'm still in the process of sorting it all out and from the looks of things it might take me a bit - but in fact I'm not too keen on redoing my current project - especially since it does everything I want the way I need it.
I did have all of the wxWidgets stuff compiled to produce a DLL, but somewhere along the way, when I set up my current project, it turns out I went back to my static library directories and because it all worked - even though I was under the impression it wasn't supposed to - I never really questioned and investigated it further.
So perhaps that is the real 'secret'
Have a look at my project files and you will notice that in the include directories path and the linker library path I have used vc_lib instead of vc_dll.
I'll attach a release version of the compiled program and plugin dll to let you try and see if it all runs OK on your system as it does on mine. - tried, but the file is too big, of course - each is over 1 MB :-(
Looks like I may have to recompile even my project to use wxWidgets as a DLL
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

fischi
Earned a small fee
Earned a small fee
Posts: 14
Joined: Fri Apr 18, 2008 11:02 am

Post by fischi » Tue May 06, 2008 6:27 am

Hi tan. It works! That was the hole secret to comment out these lines. You helped me really a lot. Thank you very much. Special thanks to Widgets too, because he tried all the time to find a solution without giving up. So both of you, thank you really very very much.
i use MS VC++ 2005 Express, windows xp, wxWidgets 2.8.7

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 387
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets » Tue May 06, 2008 6:37 pm

Thanks for letting us know; It is always good for the next guy who has the same problem to find the real solution :-)

I might even need it myself if I decide to move to a Dll based app.
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Widgets
Super wx Problem Solver
Super wx Problem Solver
Posts: 387
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Post by Widgets » Tue May 06, 2008 11:32 pm

After spending a bit more time at it, I have been able to compile and link the basic plugin example posted by upCase
http://www.upcase.de/stuff/wxPlugin.zip
as two linked programs, one an exe, the plugin as a dll, both using wxWidgets as DLLs and I see the same problem fischi described and showed.
When I move the pop up dialog over the main application, its main frame does not update.
When - for the plugin only - I comment out the section recommended by tan - it all works as "advertised" :-)

So now I have to decide whether I want to carry on with my statically linked version or modify things and move to a DLL based version.
Environment: Win 10 64-bit & Mint 10.2
MSVC Express 2010, 2015, 2017, 2019
wxWidgets 3.1.2
Fight SPAM - report it with wxSR

Post Reply