trouble with wxDynamicLibrary Topic is solved
the project files
- Attachments
-
- Basis_sourceforge.rar
- main app
- (5.24 KiB) Downloaded 87 times
-
- Plugin_sourceforge.rar
- plugin
- (17.17 KiB) Downloaded 83 times
i use MS VC++ 2005 Express, windows xp, wxWidgets 2.8.7
-
- wxWorld Domination!
- Posts: 1471
- Joined: Tue Nov 14, 2006 7:58 am
- Location: Saint-Petersburg, Russia
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:
Look here for more information:
http://forums.wxwidgets.org/viewtopic.php?t=12680
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."));
}
http://forums.wxwidgets.org/viewtopic.php?t=12680
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10
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
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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
MSVC Express 2019/2022
wxWidgets 3.2.2
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
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.
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/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
MSVC Express 2019/2022
wxWidgets 3.2.2