Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / dll vs. static linking.

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. dll vs. static linking.
#3220
Posted by: 2004-01-12 11:30:42

I am trying to get a wxWindows program to load a shared library (.so) using wxDLLLoader. When I create my wxWindows (2.4.1) environment using --enable-shared option of ./configure, and build the main "loader" program and the shared library using wxmsw241.dll, then everything works like a charm. If I create the wxWindows environment using --disable-shared so that wx stuff gets statically linked with the main program and the shared library (which contains wxWindows widgets etc.), then I can't get the main program to function properly. It does still load the shared library, but as soon as I make a function call from the shared library, the main program crashes with the following message:

"Instruction at 0x64ba79cf referenced memory at 0x0000000c. The memory could not be read."

Does anyone have an idea why linking wxwindows as an external DLL works but statically linking it does not?

Message2. Re: dll vs. static linking.
#3223
Posted by: upCASE 2004-01-12 19:01:53
Hi!
Try this example:
http://wiki.wxwindows.org/wiki.pl?Programs_That_Support_Plugins
It worked for me. Maybe this is what you want to do.

upCASE
-----------------------------------
If it was hard to write, it should be hard to read!- Do. Or do not. There is no try!
Message3. Re: dll vs. static linking.
#3226
Posted by: 2004-01-13 01:47:57

That looks like a nice sample program. Thanks for pointing it out to me. I have one question on it though. Where are the plugins getting unloaded when the program is exited? I don't see any unloading done in the program. The program only uses "LoadLibrary" function. Does wxWindows take care of the unloading automatically somehow or is it just a bug in the sample program?

There doesn't seem to be any documentation on wxPluginLibrary. I guess I need to dig into the wxWindows source code to figure out what it does and how to use it, etc...
Message4. Re: dll vs. static linking.
#3227
Posted by: 2004-01-13 01:51:08
OOps!! I meant to say wxPluginManager. Sorry about that.  By the way, I referred to this URL to see if there is any documentation:

http://www.wxwindows.org/manuals/2.4.2/wx26.htm#classref

Even a search on Google returns 6 results none of which are helpful.

Thanks again!
Message5. Re: dll vs. static linking.
#3228
Posted by: guidance 2004-01-13 07:45:49
Search wx/include may helpful, usually.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Tue 2022-10-4  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0