Jump to content
  • Advertisement
Sign in to follow this  
Lust

Need help for wxWidgets and a DLL

This topic is 4446 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I am having a problem which I cannot solve for nearly a month. Some code follows: class cEditor { .... wxFrame *m_MainFrame; .... }; typedef void (*PlugInReg)( cEditor * ); //in the DLL project: // the actual <cEditor *Editor> is declared in the project loading the DLL extern "C" declspec (dllexport) void PlugInRegister( cEditor *Editor ) { wxMenu *menu = new wxMenu(); menu->Append( wxID_ANY, "Some..." ); Editor->m_MainFrame->m_MenuBar->Append( menu, "DLL Appended" ); } //in the main project cEditor *Editor; void MyApp::OnInit(...) { // Editor is new'd // Editor->m_MainFrame is initialized // pseudo plug-in is loaded here HINSTANCE *hDLL1 = LoadLibrary("..."); PlugInReg RegFunc = (PlugInReg)GetProcAddress( hDLL1, "PlugInRegister" ); if( RegFunc ) { RegFunc( Editor ); } } Now this is the code, the program runs successfuly and the menu is appended:) BUT, when I close the app, wxWidgets f*cks up and throws an exception that it cannot find and destroy the string of the menu caption, i.e. "DLL Appednded" or "Some...". Is it because the loaded library is freed before deallocation of the menu memory? I have taken a look in some samples for appending a menu in WX from a DLL but they are not easily comprehensible and i am not sure that they are for the same purpose. Please help me!:)

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!