Guidance Forums / wxWidgets (wxWindows) in C++ / dll vs. static linking.

Search 搜索
Home Home

Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. dll vs. static linking.
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.
Posted by: upCASE 2004-01-12 19:01:53
Try this example:
It worked for me. Maybe this is what you want to do.

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.
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.
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:

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

Thanks again!
Message5. Re: dll vs. static linking.
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 2024-7-23  Guidance Laboratory Inc. Hits:0